Wazir Shpoon,

> If I set all the following methods to 'sql:', I get the error below:
>
> $clean_quarantine_method = 'sql:';
> $archive_quarantine_method = 'sql:';
> $virus_quarantine_method='sql:';
> $banned_files_quarantine_method='sql:';
> $spam_quarantine_method='sql:';
> $bad_header_quarantine_method='sql:';
>
> If I set $archive_quarantine_method = undef, everything works fine.
>
> Jun  8 08:51:40 vm-dev1 amavis[89431]: (89431-01) (!!)TROUBLE in
> check_mail: quar+notif FAILED: temporarily unable to quarantine: 451
> 4.5.0 Storing to sql db as mail_id F1nTjKkSHLDa failed: writing mail
> text to SQL failed: Error closing, flush: sql inserting text failed, sql
> exec: err=1062, 23000, DBD::mysql::st execute failed: Duplicate entry
> 'F1nTjKkSHLDa-1' for key 1

Thanks for the problem report.

The following patch to 2.5.1 suppresses a quarantining attempt
if the message also needs to be archived to the same location
(same sql key or same local filename).

The problem has been there ever since archival quarantine was
introduced, but apparently nobody tried to use the same
storage method for archive and for normal quarantine.


--- amavisd.orig        Thu May 31 14:10:01 2007
+++ amavisd     Mon Jun 11 02:26:32 2007
@@ -10411,8 +10411,19 @@
         if $os_fp ne '' &&
            $allowed_hdrs && $allowed_hdrs->{lc('X-Amavis-OS-Fingerprint')};
-    do_quarantine($conn,$msginfo,$hdr_edits,[EMAIL PROTECTED],$q_method,
-                  'Quar'.$ccat_name.'Msgs')  if $q_method ne '' && @q_addr;
-    do_quarantine($conn,$msginfo,$hdr_edits,[EMAIL PROTECTED],$qar_method,
-                  'QuarArchMsgs')        if $qar_method ne '' && @qar_addr;
+    my($method_used);
+    if ($qar_method ne '' && @qar_addr) {  # archival quarantine requested
+      do_quarantine($conn,$msginfo,$hdr_edits,[EMAIL PROTECTED],$qar_method,
+                    'QuarArchMsgs');
+      $method_used = $qar_method;
+    }
+    if ($q_method ne '' && @q_addr) {  # normal quarantine requested
+      # simpleminded collision check, does not take into account quarantine_to
+      if (defined $method_used && $method_used eq $q_method) {
+        do_log(2,"Suppress quarantine, already archived as %s", $method_used);
+      } else {
+        do_quarantine($conn,$msginfo,$hdr_edits,[EMAIL PROTECTED],$q_method,
+                      'Quar'.$ccat_name.'Msgs');
+      }
+    }
   }
   if (ll(2) && $msginfo->is_in_contents_category(CC_SPAM)) {



Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to