http://bugzilla.spamassassin.org/show_bug.cgi?id=4016
Summary: excessive use of fds
Product: Spamassassin
Version: 3.0.0
Platform: All
OS/Version: other
Status: NEW
Severity: major
Priority: P2
Component: spamassassin
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Spamassassin v3.0.0 appears to be using an excessive amount
of open file descriptors for dns use. This is likely a bug.
The exact amount depends on the message being processed.
For example, the particular spam I've been testing with
below needs at least 97 open fds to successfully complete.
Many ISPs set the process limit to 64.
You can tell if you've hit this bug by the following error:
razor2 check skipped: No such file or directory
IO::Socket::INET: Bad protocol 'udp' ...propagated at
/pkg/Mail-SpamAssassin-3.000000-580/lib/site_perl/5.8.0/Mail/SpamAssassin/Dns.pm
line 447.
Here's a patch:
*** /usr/local/test-sa/lib/site_perl/5.8.0/Mail/SpamAssassin/Util.pm Mon Sep
13
19:34:05 2004
--- Mail/SpamAssassin/Util.pm Fri Dec 3 15:31:59 2004
***************
*** 724,766 ****
###########################################################################
- # 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()
! );
! if (!$tmpdir) {
! die "Cannot find a temporary directory! set TMP or TMPDIR in env";
! }
! my ($reportfile,$tmpfile);
! my $umask = umask 077;
! 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 = 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));
! umask $umask;
! return ($reportfile, $tmpfile);
}
###########################################################################
--- 724,766 ----
###########################################################################
sub secure_tmpfile {
! my ($reportfile, $suffix, $tmpdir, $tmpfile, $umask);
! my $count = 0;
!
! $tmpdir = Mail::SpamAssassin::Util::untaint_file_path(File::Spec->tmpdir)
! or die "Cannot find a temporary directory! set TMP or TMPDIR in env";
!
! $umask = umask 077;
! while (1) {
# we do not rely on the obscurity of this name for security...
# we use a average-quality PRG since this is all we need
! $suffix = join ('', (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"));
! die "Problem creating temporary file" if ++$count > 100_000;
!
! next if -e $reportfile;
!
# ...rather, we require O_EXCL|O_CREAT to guarantee us proper
# ownership of our file; read the open(2) man page.
! sysopen $tmpfile, $reportfile, O_RDWR|O_CREAT|O_EXCL, 0600
! or die "Cannot create temporary file \"$reportfile\": $!";
!
! last;
! }
! umask $umask;
! return($reportfile, $tmpfile);
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.