[Rt-commit] [svn] r773 - rt/branches/rt-3.1/lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Thu Apr 29 18:22:43 EDT 2004


Author: jesse
Date: Thu Apr 29 18:22:42 2004
New Revision: 773

Modified:
   rt/branches/rt-3.1/lib/RT/EmailParser.pm
Log:
Trying to beat  a taint bug into the ground

Modified: rt/branches/rt-3.1/lib/RT/EmailParser.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/EmailParser.pm	(original)
+++ rt/branches/rt-3.1/lib/RT/EmailParser.pm	Thu Apr 29 18:22:42 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;
 }
 
@@ -627,21 +626,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");
@@ -655,7 +653,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