Hmm... where did you get your copy of tnef2multipart from?
The "official" source at http://advosys.ca/papers/filter-misc/ uses
"open", not "concat". Perhaps you got the script through Yahoo mail or
some antivirus gateway that rewrites certain words (see
http://news.com.com/2102-1023_3-944315.html?tag=ni_print)
Good point about changing to a writable directory though. That might
explain the infrequent permission errors some folks have reported. We've
added a chdir to our version of tnef2multipart.pl, available from our
website at the above URL.
(We've also added MD5 checksums for all the scripts, just in case you are
behind a script-mangling content filter of some kind ;-)
Robbie Dinn said:
> Hello,
>
> I am a user of your tnef2multipart.pl script as part of the Anomy
> mail filter. Here is a (possible) bug report I would like to make.
>
> I hope this helps.
>
> Robbie Dinn ( robbie at microbus dot com ).
>
> From robbie Thu Sep 18 18:40:02 +0100 2003
> From: Robbie Dinn <robbie@rjd.microbus>
> To: 28200@xyz.molar.is
> Subject: possible bug + patch for tnef2multipart.pl
>
> Hello
> I would like to share my experiences of using the tnef2mulitpart.pl
> script with anomy. I initially had some problems with it, but it now
> seems to be working OK.
>
> Please bear in mind that I am not a perl programmer, so take anything
> I say with a pinch of salt.
>
> The patch at the bottom of this message contains three hunks.
>
> Hunks one and three change a 'concat' to an 'open' instead.
> I don't know what concat does. I can't find it in the perl documentation.
> (It probably there but I can't find it).
> When I run the original script I get an error message like the
> following:
>
>
> robbie@rjd:~> cp msg6/msg-3327-2.dat ~/foo.dat ; ANOMY=/usr/local/anomy
> ANOMY_CONF=~/anomy.conf perl tneffoo.pl foo.dat
> Using an array as a reference is deprecated at
> /usr/lib/perl5/site_perl/5.8.0/Date/Format.pm line 88.
> Using an array as a reference is deprecated at
> /usr/lib/perl5/site_perl/5.8.0/Date/Format.pm line 217.
> Bareword "STDERR" not allowed while "strict subs" in use at tneffoo.pl
> line 78.
> Bareword "SAN" not allowed while "strict subs" in use at tneffoo.pl
> line 133.
> Execution of tneffoo.pl aborted due to compilation errors.
> robbie@rjd:~>
>
> But if I change the concat's to open's, this problem goes away.
> I might have broken something else in the process, but it seems to
> work for me.
>
> The second of the three hunks changes the call to Convert::TNEF->read_in()
>
> I am running the perl script in a current working directory (cwd) where it
> does _not_ have permission to create new files. But the Convert::TNEF code
> seems to occasionally want to create temporary files, by default in the
> cwd.
> If it can't create the temporary file, the script fails and anomy drops
> the
> whole winmail.dat attachement instead of converting it.
>
> The change adds an extra parameter to the Convert::TNEF->read_in() call
> to tell it to make the temporary files in the $tempdir instead of the
> cwd.
>
> I have not passed this information on the the Advosys people yet,
> because I don't have an email address for them and their web site
> appears to be off line. But if someone could pass this on for me, that
> would be welcome.
>
> I hope this helps.
>
> Robbie Dinn (robbie at microbus dot com)
>
> patch follows...
>
> diff -u2 tnef2multipart.pl.orig tnef2multipart.pl
> --- tnef2multipart.pl.orig 2003-09-16 18:27:30.000000000 +0100
> +++ tnef2multipart.pl 2003-09-18 14:46:07.000000000 +0100
> @@ -68,5 +68,5 @@
> # Redirect STDOUT if required:
> #if ( $LOGFILE ) {
> -concat(STDERR, ">>$main::LOGFILE") or die "Cannot open log file
> $main::LOGFILE: $!\n" if $main::LOGFILE;
> +open(STDERR, ">>$main::LOGFILE") or die "Cannot open log file
> $main::LOGFILE: $!\n" if $main::LOGFILE;
>
> # Grab name of TNEF file to process:
> @@ -85,5 +85,5 @@
> mkdir $tempdir or die("Can't create directory $tempdir: $!\n");
>
> -my $tnef = Convert::TNEF->read_in($tneffile) or die
> $Convert::TNEF::errstr;
> +my $tnef = Convert::TNEF->read_in($tneffile,{output_dir=>"$tempdir"}) or
> die $Convert::TNEF::errstr;
>
> my @files = ();
> @@ -123,5 +123,5 @@
>
> # Quick 'n' dirty way: open a pipe to the sanitizer script:
> -concat(SAN,"|$ANOMY_BIN $ANOMY_CONF > $SPOOLDIR/mime-$$") or die "Can't
> pipe to $ANOMY_BIN: $!\n";
> +open(SAN,"|$ANOMY_BIN $ANOMY_CONF > $SPOOLDIR/mime-$$") or die "Can't
> pipe to $ANOMY_BIN: $!\n";
> $top->print(\*SAN) or die "Error piping to $ANOMY_BIN: $!\n";
> close SAN or die "Error piping to $ANOMY_BIN: $!\n";
>
>
>