[amavisd-new/el6] Add patch to fix releasing mail from sql quarantine

Juan Orti jorti at fedoraproject.org
Sun Aug 3 21:15:54 UTC 2014


commit 27c8fbc4768c6ddc1b297a37121099f95b3f33f2
Author: Juan Orti Alcaine <juan.orti at miceliux.com>
Date:   Sun Aug 3 23:15:43 2014 +0200

    Add patch to fix releasing mail from sql quarantine

 ...ew-2.9.1-release_mail_from_sql_quarantine.patch |   51 ++++++++++++++++++++
 amavisd-new.spec                                   |    9 +++-
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/amavisd-new-2.9.1-release_mail_from_sql_quarantine.patch b/amavisd-new-2.9.1-release_mail_from_sql_quarantine.patch
new file mode 100644
index 0000000..fe5fc04
--- /dev/null
+++ b/amavisd-new-2.9.1-release_mail_from_sql_quarantine.patch
@@ -0,0 +1,51 @@
+diff --git a/amavisd b/amavisd
+index f721756..2a2c418 100755
+--- a/amavisd
++++ b/amavisd
+@@ -20208,7 +20208,7 @@ sub preprocess_policy_query($$) {
+     new_am_id('rel-'.$msginfo->mail_id)  if $releasing;
+     if ($releasing && $quar_type eq 'Q') {  # releasing from SQL
+       do_log(5, "preprocess_policy_query: opening in sql: %s",
+-                $msginfo->mail_id);
++                $msginfo->parent_mail_id);
+       my $obj = $Amavis::sql_storage;
+       $Amavis::extra_code_sql_quar && $obj
+         or die "SQL quarantine code not enabled (3)";
+@@ -20218,31 +20218,31 @@ sub preprocess_policy_query($$) {
+       if (!defined($msginfo->partition_tag) &&
+           defined($sel_msg) && $sel_msg ne '') {
+         do_log(5, "preprocess_policy_query: missing partition_tag in request,".
+-                  " fetching msgs record for mail_id=%s", $msginfo->mail_id);
++                  " fetching msgs record for mail_id=%s", $msginfo->parent_mail_id);
+         # find a corresponding partition_tag if missing from a release request
+         $conn_h->begin_work_nontransaction;  #(re)connect if necessary
+-        $conn_h->execute($sel_msg, untaint($msginfo->mail_id));
++        $conn_h->execute($sel_msg, untaint($msginfo->parent_mail_id));
+         my $a_ref; my $cnt = 0; my $partition_tag;
+         while ( defined($a_ref=$conn_h->fetchrow_arrayref($sel_msg)) ) {
+           $cnt++;
+           $partition_tag = $a_ref->[0]  if !defined $partition_tag;
+           ll(5) && do_log(5, "release: got msgs record for mail_id=%s: %s",
+-                             $msginfo->mail_id, join(', ',@$a_ref));
++                             $msginfo->parent_mail_id, join(', ',@$a_ref));
+         }
+         $conn_h->finish($sel_msg)  if defined $a_ref;  # only if not all read
+         $cnt <= 1 or die "Multiple ($cnt) records with same mail_id exist, ".
+                          "specify a partition_tag in the AM.PDP request";
+         if ($cnt < 1) {
+           do_log(0, "release: no records with msgs.mail_id=%s in a database, ".
+-                    "trying to read from a quar. anyway", $msginfo->mail_id);
++                    "trying to read from a quar. anyway", $msginfo->parent_mail_id);
+         }
+         $msginfo->partition_tag($partition_tag);  # could still be undef/NULL !
+       }
+       ll(5) && do_log(5, "release: opening mail_id=%s, partition_tag=%s",
+-                         $msginfo->mail_id, $msginfo->partition_tag);
++                         $msginfo->parent_mail_id, $msginfo->partition_tag);
+       $conn_h->begin_work_nontransaction;  # (re)connect if not connected
+       $fh = Amavis::IO::SQL->new;
+-      $fh->open($conn_h, $sel_quar, untaint($msginfo->mail_id),
++      $fh->open($conn_h, $sel_quar, untaint($msginfo->parent_mail_id),
+                 'r', untaint($msginfo->partition_tag))
+         or die "Can't open sql obj for reading: $!";  1;
+     } else {  # mail checking or releasing from a file
diff --git a/amavisd-new.spec b/amavisd-new.spec
index 95d67cd..dacaf1a 100644
--- a/amavisd-new.spec
+++ b/amavisd-new.spec
@@ -3,7 +3,7 @@
 Summary:        Email filter with virus scanner and spamassassin support
 Name:           amavisd-new
 Version:        2.9.1
-Release:        1%{?prerelease:.%{prerelease}}%{?dist}
+Release:        2%{?prerelease:.%{prerelease}}%{?dist}
 # LDAP schema is GFDL, some helpers are BSD, core is GPLv2+
 License:        GPLv2+ and BSD and GFDL
 Group:          Applications/System
@@ -25,6 +25,9 @@ Patch2:         amavisd-condrestart.patch
 # and it can't be relied upon to exist in recent Fedora builds. Mail
 # sent upstream to amavis-users ML 2013-05-10. -adamw
 Patch3:         amavisd-new-2.8.0-init_network.patch
+# Fix bug #1121552
+# http://lists.amavis.org/pipermail/amavis-users/2014-June/002957.html
+Patch4:         amavisd-new-2.9.1-release_mail_from_sql_quarantine.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:       clamd
 Requires:       tmpwatch
@@ -124,6 +127,7 @@ alerting purposes.
 %patch1 -p1
 %patch2 -p0
 %patch3 -p1
+%patch4 -p1
 
 install -p -m 644 %{SOURCE4} %{SOURCE5} README_FILES/
 sed -e 's,/var/amavis/amavisd.sock\>,%{_localstatedir}/spool/amavisd/amavisd.sock,' -i amavisd-release
@@ -231,6 +235,9 @@ fi
 %{_sbindir}/amavisd-snmp-subagent
 
 %changelog
+* Sun Aug 03 2014 Juan Orti Alcaine <jorti at fedoraproject.org> 2.9.1-2
+- Add patch to fix releasing mail from sql quarantine
+
 * Sat Jun 28 2014 Juan Orti Alcaine <jorti at fedoraproject.org> 2.9.1-1
 - Update to 2.9.1
 


More information about the scm-commits mailing list