[Mimedefang] [PATCH] SpamAssassin should use MIMEdefang $CWD instead of /tmp for DCC/PYZOR checks

Martin Blapp mb at imp.ch
Fri Apr 29 06:53:59 EDT 2005


Hi,

I noticed that spamassassin does create files in /tmp if used within
Mimedefang. And I really think those files don't belong there, since
I've made a ramdisk for the Mimedefang spool dir.

First I thought this could be achieved with setting $TMP or $TEMPDIR in ENV,
but this didn't help, unfortunately.

The change to spamassassin is small, but works wonderful:

Instead of:

/tmp/spamassassin.38827.iALQHS.tmp

we have now:

/var/spool/MIMEDefang/mdefang-j3TAmZJe021409/spamassassin.38827.iALQHS.tmp

--- lib/Mail/SpamAssassin/Util.pm       Tue Mar 29 10:29:02 2005
+++ lib/Mail/SpamAssassin/Util.pm       Fri Apr 29 12:44:04 2005
@@ -42,6 +42,7 @@
  use Sys::Hostname (); # don't import hostname() into this namespace!
  use Fcntl;
  use POSIX (); # don't import anything unless we ask explicitly!
+use Cwd;

  ###########################################################################

@@ -738,9 +750,7 @@
  # thanks to http://www2.picante.com:81/~gtaylor/autobuse/ for this
  # code.
  sub secure_tmpfile {
-  my $tmpdir = Mail::SpamAssassin::Util::untaint_file_path(
-                 File::Spec->tmpdir()
-               );
+  my $tmpdir = Mail::SpamAssassin::Util::untaint_file_path(getcwd);
    if (!$tmpdir) {
      die "Cannot find a temporary directory! set TMP or TMPDIR in env";
    }

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------



More information about the MIMEDefang mailing list