You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2007/02/13 18:02:36 UTC
svn commit: r507100 - in /spamassassin/branches/3.1:
lib/Mail/SpamAssassin.pm sa-update.raw
Author: felicity
Date: Tue Feb 13 09:02:35 2007
New Revision: 507100
URL: http://svn.apache.org/viewvc?view=rev&rev=507100
Log:
bug 5171: allow sa-update to lint the site pre files, and then use them when linting channels
Modified:
spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm
spamassassin/branches/3.1/sa-update.raw
Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm?view=diff&rev=507100&r1=507099&r2=507100
==============================================================================
--- spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin.pm Tue Feb 13 09:02:35 2007
@@ -222,6 +222,12 @@
If set to 1, no tests that require internet access will be performed. (default:
0)
+=item ignore_site_cf_files
+
+If set to 1, any rule files found in the C<site_rules_filename> directory will
+be ignored. *.pre files (used for loading plugins) found in the
+C<site_rules_filename> directory will still be used. (default: 0)
+
=item dont_copy_prefs
If set to 1, the user preferences file will not be created if it doesn't
@@ -1386,7 +1392,7 @@
}
$fname = $siterules;
- if ($fname) {
+ if ($fname && !$self->{ignore_site_cf_files}) {
$self->{config_text} .= $self->read_cf ($fname, 'site rules dir');
}
Modified: spamassassin/branches/3.1/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/sa-update.raw?view=diff&rev=507100&r1=507099&r2=507100
==============================================================================
--- spamassassin/branches/3.1/sa-update.raw (original)
+++ spamassassin/branches/3.1/sa-update.raw Tue Feb 13 09:02:35 2007
@@ -384,6 +384,9 @@
# Use a temporary directory for all update channels
my $UPDTmp;
+# we only need to lint the site pre files once
+my $site_pre_linted = 0;
+
# Go ahead and loop through all of the channels
foreach my $channel (@channels) {
dbg("channel: attempting channel $channel");
@@ -451,6 +454,30 @@
next;
}
+ # we need a directory we control that we can use to aviod loading any rules
+ # when we lint the site pre files, we might as well use the channel temp dir
+ dbg("channel: preparing temp directory for new channel");
+ if (!$UPDTmp) {
+ $UPDTmp = Mail::SpamAssassin::Util::secure_tmpdir();
+ dbg("generic: update tmp directory $UPDTmp");
+ }
+ elsif (!clean_update_dir($UPDTmp)) {
+ die "channel: attempt to clean update dir failed, aborting";
+ }
+
+ # lint the site pre files (that will be used when lint checking the channel)
+ # before downloading the channel update
+ unless ($site_pre_linted) {
+ dbg("generic: lint checking site pre files once before attempting channel updates");
+ unless (lint_check_dir(File::Spec->catfile($UPDTmp, "doesnotexist"))) {
+ dbg("generic: lint of site pre files failed, cannot continue");
+ $exit = 2;
+ last;
+ }
+ dbg("generic: lint check of site pre files succeeded, continuing with channel updates");
+ $site_pre_linted = 1;
+ }
+
# Read in the MIRRORED.BY file if it exists
if (open(MIRBY, $mirby_path)) {
local $/ = undef;
@@ -693,15 +720,6 @@
# OK, we're all validated at this point, install the new version
dbg("channel: file verification passed, testing update");
- dbg("channel: preparing temp directory for new channel");
- if (!$UPDTmp) {
- $UPDTmp = Mail::SpamAssassin::Util::secure_tmpdir();
- dbg("generic: update tmp directory $UPDTmp");
- }
- elsif (!clean_update_dir($UPDTmp)) {
- die "channel: attempt to clean update dir failed, aborting";
- }
-
dbg("channel: extracting archive");
if (!taint_safe_archive_extract($UPDTmp, $content_file)) {
channel_failed("channel: archive extraction failed");
@@ -1204,17 +1222,18 @@
# Logger setup), we can't change the debug level here to only include
# "config" or otherwise be more terse. :(
my $spamtest = new Mail::SpamAssassin( {
- rules_filename => $dir,
- site_rules_filename => File::Spec->catfile($dir, "doesnotexist"),
- userprefs_filename => File::Spec->catfile($dir, "doesnotexist"),
-
- local_tests_only => 1,
- dont_copy_prefs => 1,
-
- PREFIX => $PREFIX,
- DEF_RULES_DIR => $DEF_RULES_DIR,
- LOCAL_RULES_DIR => $LOCAL_RULES_DIR,
- LOCAL_STATE_DIR => $LOCAL_STATE_DIR,
+ rules_filename => $dir,
+ site_rules_filename => $LOCAL_RULES_DIR,
+ ignore_site_cf_files => 1,
+ userprefs_filename => File::Spec->catfile($dir, "doesnotexist"),
+
+ local_tests_only => 1,
+ dont_copy_prefs => 1,
+
+ PREFIX => $PREFIX,
+ DEF_RULES_DIR => $DEF_RULES_DIR,
+ LOCAL_RULES_DIR => $LOCAL_RULES_DIR,
+ LOCAL_STATE_DIR => $LOCAL_STATE_DIR,
});
# need to kluge disabling bayes since it may try to expire the DB, and
@@ -1401,6 +1420,10 @@
installed successfully if --checkonly was not specified.
An exit code of C<1> means no fresh updates were available.
+
+An exit code of C<2> means that at least one update is available but that a
+lint check of the site pre files failed. The site pre files must pass a lint
+check before any updates are attempted.
An exit code of C<4> or higher, indicates that errors occurred while
attempting to download and extract updates.