You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/02/01 02:46:47 UTC
svn commit: rev 6393 - incubator/spamassassin/trunk/lib/Mail/SpamAssassin
Author: mss
Date: Sat Jan 31 17:46:46 2004
New Revision: 6393
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Log:
Tried to find out why 'make test' fails with
t/bayesdbm....ok 32/43Can't use an undefined value as a symbol reference at ../lib/Mail/SpamAssassin/ArchiveIterator.pm line 296.
Anybody an idea?
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Sat Jan 31 17:46:46 2004
@@ -656,28 +656,34 @@
# thanks to http://www2.picante.com:81/~gtaylor/autobuse/ for this
# code.
sub secure_tmpfile {
- my $tmpdir = File::Spec->tmpdir();
+ my $tmpdir = Mail::SpamAssassin::Util::untaint_file_path(
+ File::Spec->tmpdir()
+ );
if (!$tmpdir) {
- die "cannot write to a temporary directory! set TMP or TMPDIR in env";
+ die "Cannot find a temporary directory! set TMP or TMPDIR in env";
}
- $tmpdir = Mail::SpamAssassin::Util::untaint_file_path ($tmpdir);
- my $template = $tmpdir."/sa.$$.";
-
my $reportfile;
my $umask = 0;
do {
# we do not rely on the obscurity of this name for security...
# we use a average-quality PRG since this is all we need
my $suffix = join ('',
- (0..9, 'A'..'Z','a'..'z')[rand 62,
- rand 62,
- rand 62,
- rand 62,
- rand 62,
- rand 62]);
- $reportfile = $template . $suffix;
-
+ (0..9, 'A'..'Z','a'..'z')[rand 62,
+ rand 62,
+ rand 62,
+ rand 62,
+ rand 62,
+ rand 62]);
+ $reportfile = File::Spec->catfile(
+ $tmpdir,
+ join ('.',
+ "spamassassin",
+ $$,
+ $suffix,
+ "tmp",
+ )
+ );
# ...rather, we require O_EXCL|O_CREAT to guarantee us proper
# ownership of our file; read the open(2) man page.
} while (! sysopen (TMPFILE, $reportfile, O_RDWR|O_CREAT|O_EXCL, 0600));