[Rt-commit] [svn] r778 - in rt/trunk: . lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Fri Apr 30 01:42:19 EDT 2004


Author: jesse
Date: Fri Apr 30 01:42:18 2004
New Revision: 778

Modified:
   rt/trunk/   (props changed)
   rt/trunk/lib/RT/EmailParser.pm
Log:
 ----------------------------------------------------------------------
 r1402 at debian:  jesse | 2004-04-30T14:44:55.419589Z
 
 Backporting a taint fix for the EmailParser from 3.1
 
 ----------------------------------------------------------------------


Modified: rt/trunk/lib/RT/EmailParser.pm
==============================================================================
--- rt/trunk/lib/RT/EmailParser.pm	(original)
+++ rt/trunk/lib/RT/EmailParser.pm	Fri Apr 30 01:42:18 2004
@@ -62,7 +62,6 @@
   my $class = ref($proto) || $proto;
   my $self  = {};
   bless ($self, $class);
-  $self->{'AttachmentDir'} = File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 );
   return $self;
 }
 
@@ -591,21 +590,20 @@
     ## Over max size and return them
 
 sub _SetupMIMEParser {
-    my $self = shift;
+    my $self   = shift;
     my $parser = shift;
 
     # Set up output directory for files:
-    # Untaint the attachment dir, because MIME::Tools will choke otherwise
-    if ($self->{'AttachmentDir'} =~ /^(.*)$/) {
-        $parser->output_dir($1);
-    } 
-    $parser->filer->ignore_filename(1);
 
+    my $tmpdir = File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 );
+    push ( @{ $self->{'AttachmentDirs'} }, $tmpdir );
+    $parser->output_dir($tmpdir);
+    $parser->filer->ignore_filename(1);
 
     #If someone includes a message, extract it
     $parser->extract_nested_messages(1);
 
-    $parser->extract_uuencode(1);           ### default is false
+    $parser->extract_uuencode(1);    ### default is false
 
     # Set up the prefix for files with auto-generated names:
     $parser->output_prefix("part");
@@ -619,7 +617,7 @@
 
 sub DESTROY {
     my $self = shift;
-    File::Path::rmtree([$self->{'AttachmentDir'}],0,1);
+    File::Path::rmtree([@{$self->{'AttachmentDirs'}}],0,1);
 }
 
 


More information about the Rt-commit mailing list