]> git.pld-linux.org Git - packages/dovecot-antispam.git/commitdiff
- updated to current upstream git auto/th/dovecot-antispam-2.0-33
authorJan Rękorajski <baggins@pld-linux.org>
Thu, 6 Apr 2017 00:03:03 +0000 (02:03 +0200)
committerJan Rękorajski <baggins@pld-linux.org>
Thu, 6 Apr 2017 00:03:03 +0000 (02:03 +0200)
- rel 33

dovecot-2.2.14.patch [deleted file]
dovecot-2.2.patch [deleted file]
dovecot-antispam-git.patch
dovecot-antispam.spec

diff --git a/dovecot-2.2.14.patch b/dovecot-2.2.14.patch
deleted file mode 100644 (file)
index 7e48f07..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-From d17c6a9c34aa407d2ced8488389520903f16971f Mon Sep 17 00:00:00 2001
-From: Ron <ron@debian.org>
-Date: Sat, 25 Oct 2014 00:36:12 +1030
-Subject: Include the patch level in the dovecot version checks
-
-Dovecot broke the t_push() API for 2.2.14 so just checking the major/minor
-versions is no longer enough.  Bonus points for it not actually exporting
-that version anywhere itself, so we still need to parse the full string to
-get it.
-
-There's a chance this might break some things for dovecot < 2.0 or so
-(based mostly on the theory that the patch=255 fallback coded into the
-dovecot-version.c parsing was put there for a reason), but we might be
-well past the stage of needing to worry about that now.  If someone
-tests it with an earlier version and it breaks there, we'll worry about
-that when they report how and where it breaks.
-
-diff --git a/antispam-plugin.c b/antispam-plugin.c
-index 103b5fb..6ea49cf 100644
---- a/antispam-plugin.c
-+++ b/antispam-plugin.c
-@@ -70,7 +70,7 @@ static void lowercase_string(const char *in, char *out)
- }
- static bool mailbox_patternmatch(struct mailbox *box,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                                const struct mail_namespace *ns,
- #else
-                                struct mail_storage *storage,
-@@ -82,7 +82,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
-       int len;
-       int rc;
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-       if (ns && mailbox_get_namespace(box) != ns)
-               return FALSE;
- #else
-@@ -116,7 +116,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
- }
- static bool mailbox_patternmatch_case(struct mailbox *box,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                                     const struct mail_namespace *ns,
- #else
-                                     struct mail_storage *ns,
-@@ -127,7 +127,7 @@ static bool mailbox_patternmatch_case(struct mailbox *box,
- }
- static bool mailbox_patternmatch_icase(struct mailbox *box,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                                      const struct mail_namespace *ns,
- #else
-                                      struct mail_storage *ns,
-@@ -138,7 +138,7 @@ static bool mailbox_patternmatch_icase(struct mailbox *box,
- }
- static bool _mailbox_equals(struct mailbox *box,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                           const struct mail_namespace *ns,
- #else
-                           struct mail_storage *ns,
-@@ -149,7 +149,7 @@ static bool _mailbox_equals(struct mailbox *box,
- }
- typedef bool (*match_fn_t)(struct mailbox *,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                          const struct mail_namespace *,
- #else
-                          struct mail_storage *,
-@@ -187,7 +187,7 @@ static bool mailbox_in_list(struct mailbox *box, char ** const * patterns)
-               while (*list) {
-                       if (match_info[i].fn(box,
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
-                                            mailbox_get_namespace(box),
- #else
-                                            mailbox_get_storage(box),
-@@ -374,7 +374,7 @@ void antispam_free_config(struct antispam_config *cfg)
-       i_free(cfg);
- }
--#if DOVECOT_IS_GE(2,0)
-+#if DOVECOT_IS_GE(2,0,0)
- void PLUGIN_FUNCTION(init)(struct module *module)
- {
-       antispam_storage_init(module);
-@@ -392,7 +392,7 @@ void PLUGIN_FUNCTION(deinit)(void)
- }
- /* put dovecot version we built against into plugin for checking */
--#ifdef DOVECOT_ABI_VERSION
-+#if DOVECOT_IS_GE(2,2,0)
- const char *PLUGIN_FUNCTION(version) = DOVECOT_ABI_VERSION;
- #else
- const char *PLUGIN_FUNCTION(version) = PACKAGE_VERSION;
-diff --git a/antispam-plugin.h b/antispam-plugin.h
-index a06f7be..724ab5e 100644
---- a/antispam-plugin.h
-+++ b/antispam-plugin.h
-@@ -4,7 +4,7 @@
- #include "lib.h"
- #include "str.h"
- #include "dovecot-version.h"
--#if DOVECOT_IS_GE(2, 0)
-+#if DOVECOT_IS_GE(2,0,0)
- #include "imap-client.h"
- #else
- #include "client.h"
-@@ -186,7 +186,7 @@ void antispam_free_config(struct antispam_config *cfg);
- /*
-  * Dovecot version compat code
-  */
--#if DOVECOT_IS_EQ(1, 0)
-+#if DOVECOT_IS_GE(1,0,0) && DOVECOT_IS_LT(1,1,0)
- #define module_arg            void
- #define ATTR_UNUSED           __attr_unused__
- #define mempool_unref(x)      pool_unref(*(x))
-@@ -217,7 +217,7 @@ static inline int _mail_get_stream(struct mail *mail,
-       return 0;
- }
- #define mail_get_stream _mail_get_stream
--#elif DOVECOT_IS_EQ(1, 1)
-+#elif DOVECOT_IS_GE(1,1,0) && DOVECOT_IS_LT(1,2,0)
- #define mempool_unref         pool_unref
- #define module_arg            void
- #define ME(err)                       MAIL_ERROR_ ##err,
-@@ -236,7 +236,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
- {
-       return o_stream_create_fd(fd, 0, TRUE);
- }
--#elif DOVECOT_IS_EQ(1, 2)
-+#elif DOVECOT_IS_GE(1,2,0) && DOVECOT_IS_LT(2,0,0)
- #define mempool_unref         pool_unref
- #define module_arg            void
- #define ME(err)                       MAIL_ERROR_ ##err,
-@@ -255,7 +255,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
- {
-       return o_stream_create_fd(fd, 0, TRUE);
- }
--#elif DOVECOT_IS_EQ(2, 0) || DOVECOT_IS_EQ(2, 1)
-+#elif DOVECOT_IS_GE(2,0,0) && DOVECOT_IS_LT(2,2,0)
- #define mempool_unref         pool_unref
- #define module_arg            struct module *
- #define ME(err)                       MAIL_ERROR_ ##err,
-@@ -277,7 +277,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
- {
-       return dict_init(uri, DICT_DATA_TYPE_STRING, username, NULL);
- }
--#elif DOVECOT_IS_EQ(2, 2)
-+#elif DOVECOT_IS_GE(2,2,0)
- #define mempool_unref         pool_unref
- #define module_arg            struct module *
- #define ME(err)                       MAIL_ERROR_ ##err,
-diff --git a/dovecot-version.c b/dovecot-version.c
-index e7e7cf2..a9f980a 100644
---- a/dovecot-version.c
-+++ b/dovecot-version.c
-@@ -40,19 +40,19 @@ int main(int argc, char **argv)
-       printf("/* Auto-generated file, do not edit */\n\n");
-       printf("#define DOVECOT_VERSION_CODE(maj, min, patch)   "
-               "((maj)<<16 | ((min)<<8) | (patch))\n\n");
--      
-+
-       printf("#define DOVECOT_VCODE                           "
--              "0x%.2x%.2x%.2x\n", maj, min, 0);
--      printf("#define DOVECOT_IS_EQ(maj, min)                 "
--              "DOVECOT_VCODE == DOVECOT_VERSION_CODE(maj, min, 0)\n");
--      printf("#define DOVECOT_IS_GT(maj, min)                 "
--              "DOVECOT_VCODE > DOVECOT_VERSION_CODE(maj, min, 0)\n");
--      printf("#define DOVECOT_IS_GE(maj, min)                 "
--              "DOVECOT_VCODE >= DOVECOT_VERSION_CODE(maj, min, 0)\n");
--      printf("#define DOVECOT_IS_LT(maj, min)                 "
--              "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, 0)\n");
--      printf("#define DOVECOT_IS_LE(maj, min)                 "
--              "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, 0)\n");
-+              "0x%.2x%.2x%.2x\n", maj, min, patch);
-+      printf("#define DOVECOT_IS_EQ(maj, min, patch)          "
-+              "DOVECOT_VCODE == DOVECOT_VERSION_CODE(maj, min, patch)\n");
-+      printf("#define DOVECOT_IS_GT(maj, min, patch)          "
-+              "DOVECOT_VCODE > DOVECOT_VERSION_CODE(maj, min, patch)\n");
-+      printf("#define DOVECOT_IS_GE(maj, min, patch)          "
-+              "DOVECOT_VCODE >= DOVECOT_VERSION_CODE(maj, min, patch)\n");
-+      printf("#define DOVECOT_IS_LT(maj, min, patch)          "
-+              "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, patch)\n");
-+      printf("#define DOVECOT_IS_LE(maj, min, patch)          "
-+              "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, patch)\n");
-       /* Use the antispam-storage-2.0.c for dovecot 2.1 and 2.2 as well */
-       if (maj == 2 && min < 3)
--- 
-cgit v0.10.2
-
-From 2aa93d15409f5a47589d264991fd3e8261d34b1b Mon Sep 17 00:00:00 2001
-From: Ron <ron@debian.org>
-Date: Sat, 25 Oct 2014 00:47:21 +1030
-Subject: Add a compatibility macro for t_push()
-
-This should fix things for the API change in dovecot 2.2.14 reported in:
-https://bugs.debian.org/765943
-
-diff --git a/antispam-plugin.h b/antispam-plugin.h
-index 724ab5e..939e27e 100644
---- a/antispam-plugin.h
-+++ b/antispam-plugin.h
-@@ -299,6 +299,10 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
- #define module_arg            struct module *
- #define ME(err)                       MAIL_ERROR_ ##err,
-+#if DOVECOT_IS_GE(2,2,14)
-+#define t_push()              t_push(__func__)
-+#endif
-+
- static inline const char *const *
- get_mail_headers(struct mail *mail, const char *hdr)
- {
--- 
-cgit v0.10.2
-
diff --git a/dovecot-2.2.patch b/dovecot-2.2.patch
deleted file mode 100644 (file)
index 8e7e881..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-diff -ur dovecot-antispam-2.0/antispam-plugin.h dovecot-antispam-2.0-2.2/antispam-plugin.h
---- dovecot-antispam-2.0/antispam-plugin.h     2013-07-16 08:49:17.445971507 +0200
-+++ dovecot-antispam-2.0-2.2/antispam-plugin.h 2013-07-16 08:47:54.968547139 +0200
-@@ -287,6 +287,25 @@
- {
-       return dict_init(uri, DICT_DATA_TYPE_STRING, username, NULL);
- }
-+#elif DOVECOT_IS_EQ(2, 2)
-+#define mempool_unref         pool_unref
-+#define module_arg            struct module *
-+#define ME(err)                       MAIL_ERROR_ ##err,
-+
-+static inline const char *const *
-+get_mail_headers(struct mail *mail, const char *hdr)
-+{
-+      const char *const *ret;
-+      if (mail_get_headers(mail, hdr, &ret))
-+              return NULL;
-+      return ret;
-+}
-+
-+static inline struct ostream *
-+o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
-+{
-+      return o_stream_create_fd(fd, 0, TRUE);
-+}
- #else
- #error "Building against this dovecot version is not supported"
- #endif
-diff -ur dovecot-antispam-2.0/dovecot-version.c dovecot-antispam-2.0-2.2/dovecot-version.c
---- dovecot-antispam-2.0/dovecot-version.c     2013-07-16 08:49:17.445971507 +0200
-+++ dovecot-antispam-2.0-2.2/dovecot-version.c 2013-07-16 08:48:53.755753877 +0200
-@@ -55,7 +55,7 @@
-               "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, 0)\n");
-       /* Use the antispam-storage-2.0.c for dovecot 2.1 as well */
--      if (maj == 2 && min == 1)
-+      if (maj == 2 && (min == 1 || min == 2))
-               min = 0;
-       printf("#define ANTISPAM_STORAGE                        "
---- dovecot-antispam-2.0/antispam-plugin.c~    2011-11-07 10:49:47.000000000 +0100
-+++ dovecot-antispam-2.0/antispam-plugin.c     2013-07-23 20:19:25.951626755 +0200
-@@ -392,4 +392,8 @@
- }
- /* put dovecot version we built against into plugin for checking */
-+#ifdef DOVECOT_ABI_VERSION
-+const char *PLUGIN_FUNCTION(version) = DOVECOT_ABI_VERSION;
-+#else
- const char *PLUGIN_FUNCTION(version) = PACKAGE_VERSION;
-+#endif
index 7f11fbdfda4051a09621b7ef28f8bee16e005169..f71744770bad2071e020de7ef1603a411f0fcdf7 100644 (file)
@@ -1,7 +1,72 @@
+diff --git a/antispam-plugin.c b/antispam-plugin.c
+index 7756204..76ced7b 100644
+--- a/antispam-plugin.c
++++ b/antispam-plugin.c
+@@ -90,7 +90,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
+               return FALSE;
+ #endif
+-      t_push();
++      T_BEGIN {
+       boxname = mailbox_get_name(box);
+       if (lowercase) {
+@@ -110,7 +110,7 @@ static bool mailbox_patternmatch(struct mailbox *box,
+       rc = memcmp(name, boxname, len) == 0;
+-      t_pop();
++      } T_END;
+       return rc;
+ }
+@@ -257,7 +257,7 @@ static int parse_folder_setting(const struct antispam_config *cfg,
+       int cnt = 0;
+       enum match_type i;
+-      t_push();
++      T_BEGIN {
+       for (i = 0; i < NUM_MT; ++i) {
+               tmp = getenv(t_strconcat(setting, match_info[i].suffix, NULL),
+@@ -286,7 +286,7 @@ static int parse_folder_setting(const struct antispam_config *cfg,
+               }
+       }
+-      t_pop();
++      } T_END;
+       if (!cnt)
+               debug(&cfg->dbgcfg, "no %s folders\n", display_name);
+@@ -392,4 +392,8 @@ void PLUGIN_FUNCTION(deinit)(void)
+ }
+ /* put dovecot version we built against into plugin for checking */
++#if DOVECOT_IS_GE(2,2)
++const char *PLUGIN_FUNCTION(version) = DOVECOT_ABI_VERSION;
++#else
+ const char *PLUGIN_FUNCTION(version) = PACKAGE_VERSION;
++#endif
 diff --git a/antispam-plugin.h b/antispam-plugin.h
 diff --git a/antispam-plugin.h b/antispam-plugin.h
-index 280bb12..72b906d 100644
+index 280bb12..62a3eb3 100644
 --- a/antispam-plugin.h
 +++ b/antispam-plugin.h
 --- a/antispam-plugin.h
 +++ b/antispam-plugin.h
+@@ -10,7 +10,6 @@
+ #include "client.h"
+ #endif
+ #include "ostream.h"
+-#include "dict.h"
+ #include "imap-search.h"
+ #include <stdlib.h>
+@@ -43,6 +42,7 @@ struct signature_config {
+ };
+ struct antispam_debug_config {
++      const char *prefix;
+       enum antispam_debug_target target;
+       int verbose;
+ };
 @@ -98,8 +98,10 @@ struct antispam_config {
                        int extra_env_num;
                } crm;
 @@ -98,8 +98,10 @@ struct antispam_config {
                        int extra_env_num;
                } crm;
@@ -15,17 +80,116 @@ index 280bb12..72b906d 100644
                        const char *pipe_binary;// = "/usr/sbin/sendmail";
                        const char *tmpdir;// = "/tmp";
                        char **extra_args;
                        const char *pipe_binary;// = "/usr/sbin/sendmail";
                        const char *tmpdir;// = "/tmp";
                        char **extra_args;
-@@ -260,7 +262,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+@@ -204,12 +206,6 @@ o_stream_create_from_fd(int fd, pool_t pool)
+       return o_stream_create_file(fd, pool, 0, TRUE);
+ }
+-static inline struct dict *
+-string_dict_init(const char *uri, const char *username)
+-{
+-      return dict_init(uri, username);
+-}
+-
+ static inline int _mail_get_stream(struct mail *mail,
+                                  struct message_size *hdr_size,
+                                  struct message_size *body_size,
+@@ -222,6 +218,11 @@ static inline int _mail_get_stream(struct mail *mail,
+       return 0;
+ }
+ #define mail_get_stream _mail_get_stream
++
++#define T_BEGIN \
++      STMT_START { t_push();
++#define T_END \
++      t_pop(); } STMT_END
+ #elif DOVECOT_IS_EQ(1, 1)
+ #define mempool_unref         pool_unref
+ #define module_arg            void
+@@ -231,7 +232,7 @@ static inline const char *const *
+ get_mail_headers(struct mail *mail, const char *hdr)
+ {
+       const char *const *ret;
+-      if (mail_get_headers(mail, hdr, &ret))
++      if (mail_get_headers(mail, hdr, &ret) < 0)
+               return NULL;
+       return ret;
+ }
+@@ -250,7 +251,7 @@ static inline const char *const *
+ get_mail_headers(struct mail *mail, const char *hdr)
+ {
+       const char *const *ret;
+-      if (mail_get_headers(mail, hdr, &ret))
++      if (mail_get_headers(mail, hdr, &ret) < 0)
+               return NULL;
+       return ret;
+ }
+@@ -260,7 +261,7 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
  {
        return o_stream_create_fd(fd, 0, TRUE);
  }
 -#elif DOVECOT_IS_EQ(2, 0)
  {
        return o_stream_create_fd(fd, 0, TRUE);
  }
 -#elif DOVECOT_IS_EQ(2, 0)
-+#elif DOVECOT_IS_EQ(2, 0) || DOVECOT_IS_EQ(2, 1)
++#elif DOVECOT_IS_EQ(2, 0) || DOVECOT_IS_EQ(2, 1) || DOVECOT_IS_EQ(2, 2)
  #define mempool_unref         pool_unref
  #define module_arg            struct module *
  #define ME(err)                       MAIL_ERROR_ ##err,
  #define mempool_unref         pool_unref
  #define module_arg            struct module *
  #define ME(err)                       MAIL_ERROR_ ##err,
+@@ -269,7 +270,7 @@ static inline const char *const *
+ get_mail_headers(struct mail *mail, const char *hdr)
+ {
+       const char *const *ret;
+-      if (mail_get_headers(mail, hdr, &ret))
++      if (mail_get_headers(mail, hdr, &ret) < 0)
+               return NULL;
+       return ret;
+ }
+@@ -279,12 +280,6 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
+ {
+       return o_stream_create_fd(fd, 0, TRUE);
+ }
+-
+-static inline struct dict *
+-string_dict_init(const char *uri, const char *username)
+-{
+-      return dict_init(uri, DICT_DATA_TYPE_STRING, username, NULL);
+-}
+ #else
+ #error "Building against this dovecot version is not supported"
+ #endif
+diff --git a/antispam-storage-1.1.c b/antispam-storage-1.1.c
+index f28a0cf..aab23d9 100644
+--- a/antispam-storage-1.1.c
++++ b/antispam-storage-1.1.c
+@@ -508,10 +508,10 @@ void antispam_mail_storage_created(struct mail_storage *storage)
+ static const char *_getenv(const char *env, void *data ATTR_UNUSED)
+ {
+-      t_push();
++      T_BEGIN {
+       env = t_str_ucase(t_strconcat("antispam_", env, NULL));
+       env = getenv(env);
+-      t_pop();
++      } T_END;
+       return env;
+ }
+diff --git a/antispam-storage-1.2.c b/antispam-storage-1.2.c
+index 5e0cb97..269a373 100644
+--- a/antispam-storage-1.2.c
++++ b/antispam-storage-1.2.c
+@@ -498,10 +498,10 @@ void antispam_mail_storage_created(struct mail_storage *storage)
+ static const char *_getenv(const char *env, void *data ATTR_UNUSED)
+ {
+-      t_push();
++      T_BEGIN {
+       env = t_str_ucase(t_strconcat("antispam_", env, NULL));
+       env = getenv(env);
+-      t_pop();
++      } T_END;
+       return env;
+ }
 diff --git a/antispam-storage-2.0.c b/antispam-storage-2.0.c
 diff --git a/antispam-storage-2.0.c b/antispam-storage-2.0.c
-index 5a089bc..3e67553 100644
+index 5a089bc..c3d6251 100644
 --- a/antispam-storage-2.0.c
 +++ b/antispam-storage-2.0.c
 @@ -472,7 +472,7 @@ static void antispam_mailbox_allocated(struct mailbox *box)
 --- a/antispam-storage-2.0.c
 +++ b/antispam-storage-2.0.c
 @@ -472,7 +472,7 @@ static void antispam_mailbox_allocated(struct mailbox *box)
@@ -37,8 +201,22 @@ index 5a089bc..3e67553 100644
  
        v->free = antispam_mailbox_free;
  
  
        v->free = antispam_mailbox_free;
  
+@@ -494,11 +494,11 @@ static const char *_getenv(const char *name, void *data)
+       struct mail_user *user = data;
+       const char *env;
+-      t_push();
++      T_BEGIN {
+       env = t_strconcat("antispam_", t_str_lcase(name), NULL);
+       env = mail_user_plugin_getenv(user, env);
+-      t_pop();
++      } T_END;
+       return env;
+ }
 diff --git a/antispam.7 b/antispam.7
 diff --git a/antispam.7 b/antispam.7
-index 5e33e4c..5d077f0 100644
+index 5e33e4c..497da58 100644
 --- a/antispam.7
 +++ b/antispam.7
 @@ -1,4 +1,4 @@
 --- a/antispam.7
 +++ b/antispam.7
 @@ -1,4 +1,4 @@
@@ -47,7 +225,17 @@ index 5e33e4c..5d077f0 100644
  .SH NAME
  antispam \- The dovecot antispam plugin.
  
  .SH NAME
  antispam \- The dovecot antispam plugin.
  
-@@ -206,6 +206,11 @@ plugin {
+@@ -120,6 +120,9 @@ plugin {
+     # antispam_debug_target = syslog
+     # antispam_debug_target = stderr
+     # antispam_verbose_debug = 1
++    #
++    # This can be used to get a prefix, e.g. by specifying %u in it
++    # antispam_debug_prefix = "antispam: "
+     # backend selection, MUST be configured first,
+     # there's no default so you need to set one of
+@@ -206,6 +209,11 @@ plugin {
      # semicolon-separated list of blacklisted results, case insensitive
      # antispam_dspam_result_blacklist = Virus
  
      # semicolon-separated list of blacklisted results, case insensitive
      # antispam_dspam_result_blacklist = Virus
  
@@ -59,7 +247,7 @@ index 5e33e4c..5d077f0 100644
      #=====================
      # pipe plugin
      #
      #=====================
      # pipe plugin
      #
-@@ -228,6 +233,14 @@ plugin {
+@@ -228,6 +236,14 @@ plugin {
      # "mailtrain" are still valid, these are, in the same order as
      # above: antispam_mail_sendmail, antispam_mail_sendmail_args,
      # antispam_mail_spam, antispam_mail_notspam and antispam_mail_tmpdir.
      # "mailtrain" are still valid, these are, in the same order as
      # above: antispam_mail_sendmail, antispam_mail_sendmail_args,
      # antispam_mail_spam, antispam_mail_notspam and antispam_mail_tmpdir.
@@ -74,7 +262,7 @@ index 5e33e4c..5d077f0 100644
  
      # temporary directory
      antispam_pipe_tmpdir = /tmp
  
      # temporary directory
      antispam_pipe_tmpdir = /tmp
-@@ -247,7 +260,7 @@ plugin {
+@@ -247,7 +263,7 @@ plugin {
      antispam_crm_binary = /bin/false
      # antispam_crm_binary = /usr/share/crm114/mailreaver.crm
  
      antispam_crm_binary = /bin/false
      # antispam_crm_binary = /usr/share/crm114/mailreaver.crm
  
@@ -83,7 +271,7 @@ index 5e33e4c..5d077f0 100644
      # (default unset i.e. none)
      # antispam_crm_args =
      # antispam_crm_args = --config=/path/to/config
      # (default unset i.e. none)
      # antispam_crm_args =
      # antispam_crm_args = --config=/path/to/config
-@@ -257,11 +270,6 @@ plugin {
+@@ -257,11 +273,6 @@ plugin {
      # antispam_crm_env =
      # antispam_crm_env = HOME=%h;USER=%u
  
      # antispam_crm_env =
      # antispam_crm_env = HOME=%h;USER=%u
  
@@ -95,11 +283,100 @@ index 5e33e4c..5d077f0 100644
      # NOTE: you need to set the signature for this backend
      antispam_signature = X-CRM114-CacheID
  
      # NOTE: you need to set the signature for this backend
      antispam_signature = X-CRM114-CacheID
  
+diff --git a/crm114-exec.c b/crm114-exec.c
+index 5b39ca9..d786e04 100644
+--- a/crm114-exec.c
++++ b/crm114-exec.c
+@@ -113,7 +113,7 @@ static int call_reaver(const struct antispam_config *cfg,
+               debugv(&cfg->dbgcfg, argv);
+-              t_push();
++              T_BEGIN {
+               for (i = 0; i < cfg->crm.extra_env_num; i++) {
+                       char *name, *value;
+                       name = t_strdup_noconst(cfg->crm.extra_env[i]);
+@@ -124,7 +124,7 @@ static int call_reaver(const struct antispam_config *cfg,
+                       }
+                       setenv(name, value, 1);
+               }
+-              t_pop();
++              } T_END;
+               execv(cfg->crm.reaver_binary, argv);
+               /* fall through if reaver can't be found */
+diff --git a/debug.c b/debug.c
+index d2683fa..77f0167 100644
+--- a/debug.c
++++ b/debug.c
+@@ -1,4 +1,3 @@
+-#define _BSD_SOURCE
+ #include <syslog.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -14,9 +13,9 @@ static void _debug(const struct antispam_debug_config *cfg,
+       if (cfg->target == ADT_NONE)
+               return;
+-      t_push();
++      T_BEGIN {
+-      fmt = t_strconcat("antispam: ", format, NULL);
++      fmt = t_strconcat(cfg->prefix, format, NULL);
+       switch (cfg->target) {
+       case ADT_NONE:
+@@ -30,7 +29,7 @@ static void _debug(const struct antispam_debug_config *cfg,
+               break;
+       }
+-      t_pop();
++      } T_END;
+ }
+ void debug(const struct antispam_debug_config *cfg, const char *fmt, ...)
+@@ -48,7 +47,7 @@ void debugv(const struct antispam_debug_config *cfg, char **args)
+       char *buf;
+       const char *str;
+-      t_push();
++      T_BEGIN {
+       buf = t_buffer_get(buflen);
+       while (1) {
+@@ -72,7 +71,7 @@ void debugv(const struct antispam_debug_config *cfg, char **args)
+       t_buffer_alloc(pos);
+       debug(cfg, "%s", buf);
+-      t_pop();
++      } T_END;
+ }
+ void debugv_not_stderr(const struct antispam_debug_config *cfg, char **args)
+@@ -111,6 +110,10 @@ int debug_init(struct antispam_debug_config *cfg,
+                       return -1;
+       }
++      cfg->prefix = getenv("DEBUG_PREFIX", getenv_data);
++      if (!cfg->prefix)
++              cfg->prefix = "antispam: ";
++
+       debug(cfg, "plugin initialising (%s)\n", ANTISPAM_VERSION);
+       tmp = getenv("VERBOSE_DEBUG", getenv_data);
 diff --git a/dovecot-version.c b/dovecot-version.c
 diff --git a/dovecot-version.c b/dovecot-version.c
-index cbcb35b..0026fbf 100644
+index cbcb35b..fe9bc73 100644
 --- a/dovecot-version.c
 +++ b/dovecot-version.c
 --- a/dovecot-version.c
 +++ b/dovecot-version.c
-@@ -17,21 +17,24 @@ int main(int argc, char **argv)
+@@ -1,6 +1,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
++#include <ctype.h>
+ #include "config.h"
+ int main(int argc, char **argv)
+@@ -17,21 +18,24 @@ int main(int argc, char **argv)
  
        maj = strtol(v, &e, 10);
        if (v == e)
  
        maj = strtol(v, &e, 10);
        if (v == e)
@@ -125,24 +402,66 @@ index cbcb35b..0026fbf 100644
 +                      if (v == e)
 +                              return 4;
 +              } else
 +                      if (v == e)
 +                              return 4;
 +              } else
-+                      patch = 255;
++                      patch = 0;
        }
  
        printf("/* Auto-generated file, do not edit */\n\n");
        }
  
        printf("/* Auto-generated file, do not edit */\n\n");
-@@ -50,6 +53,11 @@ int main(int argc, char **argv)
+@@ -40,6 +44,8 @@ int main(int argc, char **argv)
+       
+       printf("#define DOVECOT_VCODE                           "
+               "0x%.2x%.2x%.2x\n", maj, min, 0);
++      printf("#define DOVECOT_VCODE_PATCH                     "
++              "0x%.2x%.2x%.2x\n", maj, min, patch);
+       printf("#define DOVECOT_IS_EQ(maj, min)                 "
+               "DOVECOT_VCODE == DOVECOT_VERSION_CODE(maj, min, 0)\n");
+       printf("#define DOVECOT_IS_GT(maj, min)                 "
+@@ -50,6 +56,22 @@ int main(int argc, char **argv)
                "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, 0)\n");
        printf("#define DOVECOT_IS_LE(maj, min)                 "
                "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, 0)\n");
 +
                "DOVECOT_VCODE < DOVECOT_VERSION_CODE(maj, min, 0)\n");
        printf("#define DOVECOT_IS_LE(maj, min)                 "
                "DOVECOT_VCODE <= DOVECOT_VERSION_CODE(maj, min, 0)\n");
 +
-+      /* Use the antispam-storage-2.0.c for dovecot 2.1 as well */
-+      if (maj == 2 && min == 1)
++      printf("#define DOVECOT_P_IS_EQ(maj, min, patch)        "
++              "DOVECOT_VCODE_PATCH == DOVECOT_VERSION_CODE(maj, min, patch)\n");
++      printf("#define DOVECOT_P_IS_GT(maj, min, patch)        "
++              "DOVECOT_VCODE_PATCH > DOVECOT_VERSION_CODE(maj, min, patch)\n");
++      printf("#define DOVECOT_P_IS_GE(maj, min, patch)        "
++              "DOVECOT_VCODE_PATCH >= DOVECOT_VERSION_CODE(maj, min, patch)\n");
++      printf("#define DOVECOT_P_IS_LT(maj, min, patch)        "
++              "DOVECOT_VCODE_PATCH < DOVECOT_VERSION_CODE(maj, min, patch)\n");
++      printf("#define DOVECOT_P_IS_LE(maj, min, patch)        "
++              "DOVECOT_VCODE_PATCH <= DOVECOT_VERSION_CODE(maj, min, patch)\n");
++
++      /* Use the antispam-storage-2.0.c for dovecot 2.1 and 2.2 as well */
++      if (maj == 2 && min < 3)
 +              min = 0;
 +
        printf("#define ANTISPAM_STORAGE                        "
                "\"antispam-storage-%d.%d.c\"\n", maj, min);
  
 +              min = 0;
 +
        printf("#define ANTISPAM_STORAGE                        "
                "\"antispam-storage-%d.%d.c\"\n", maj, min);
  
+diff --git a/dspam-exec.c b/dspam-exec.c
+index 2e353ce..856babb 100644
+--- a/dspam-exec.c
++++ b/dspam-exec.c
+@@ -141,7 +141,7 @@ static int call_dspam(const struct antispam_config *cfg,
+                */
+               debugv_not_stderr(&cfg->dbgcfg, argv);
+-              t_push();
++              T_BEGIN {
+               for (i = 0; i < cfg->dspam.extra_env_num; i++) {
+                       char *name, *value;
+                       name = t_strdup_noconst(cfg->dspam.extra_env[i]);
+@@ -152,7 +152,7 @@ static int call_dspam(const struct antispam_config *cfg,
+                       }
+                       setenv(name, value, 1);
+               }
+-              t_pop();
++              } T_END;
+               execv(cfg->dspam.binary, argv);
+               debug(&cfg->dbgcfg, "executing %s failed: %d (uid=%d, gid=%d)",
 diff --git a/pipe.c b/pipe.c
 diff --git a/pipe.c b/pipe.c
-index 18c2233..a20b4aa 100644
+index 18c2233..f9abef5 100644
 --- a/pipe.c
 +++ b/pipe.c
 @@ -34,16 +34,19 @@
 --- a/pipe.c
 +++ b/pipe.c
 @@ -34,16 +34,19 @@
@@ -164,7 +483,7 @@ index 18c2233..a20b4aa 100644
        case CLASS_NOTSPAM:
 -              dest = cfg->pipe.ham_arg;
 +              dest = cfg->pipe.ham_args;
        case CLASS_NOTSPAM:
 -              dest = cfg->pipe.ham_arg;
 +              dest = cfg->pipe.ham_args;
-+              dest_num = cfg->pipe.spam_args_num;
++              dest_num = cfg->pipe.ham_args_num;
                break;
        }
  
                break;
        }
  
@@ -196,6 +515,42 @@ index 18c2233..a20b4aa 100644
  
                dup2(mailfd, 0);
                fd = open("/dev/null", O_WRONLY);
  
                dup2(mailfd, 0);
                fd = open("/dev/null", O_WRONLY);
+@@ -128,7 +136,7 @@ static int process_tmpdir(const struct antispam_config *cfg,
+       enum classification wanted;
+       int rc = 0;
+-      t_push();
++      T_BEGIN {
+       buf = t_malloc(20 + ast->tmplen);
+@@ -151,7 +159,7 @@ static int process_tmpdir(const struct antispam_config *cfg,
+               close(fd);
+       }
+-      t_pop();
++      } T_END;
+       return rc;
+ }
+@@ -160,7 +168,7 @@ static void clear_tmpdir(struct antispam_transaction_context *ast)
+ {
+       char *buf;
+-      t_push();
++      T_BEGIN {
+       buf = t_malloc(20 + ast->tmplen);
+@@ -172,7 +180,7 @@ static void clear_tmpdir(struct antispam_transaction_context *ast)
+       }
+       rmdir(ast->tmpdir);
+-      t_pop();
++      } T_END;
+ }
+ static void backend_rollback(const struct antispam_config *cfg ATTR_UNUSED,
 @@ -228,7 +236,7 @@ static int backend_handle_mail(const struct antispam_config *cfg,
                return -1;
        }
 @@ -228,7 +236,7 @@ static int backend_handle_mail(const struct antispam_config *cfg,
                return -1;
        }
@@ -205,6 +560,26 @@ index 18c2233..a20b4aa 100644
                mail_storage_set_error(t->box->storage,
                                       ME(NOTPOSSIBLE)
                                       "antispam plugin not configured");
                mail_storage_set_error(t->box->storage,
                                       ME(NOTPOSSIBLE)
                                       "antispam plugin not configured");
+@@ -242,7 +250,7 @@ static int backend_handle_mail(const struct antispam_config *cfg,
+               return -1;
+       }
+-      t_push();
++      T_BEGIN {
+       buf = t_malloc(20 + ast->tmplen);
+       i_snprintf(buf, 20 + ast->tmplen - 1, "%s/%d", ast->tmpdir, ast->count);
+@@ -303,8 +311,8 @@ static int backend_handle_mail(const struct antispam_config *cfg,
+       o_stream_destroy(&outstream);
+  out_close:
+       close(fd);
+- out:
+-      t_pop();
++ out: ;
++      } T_END;
+       return ret;
+ }
 @@ -316,20 +324,50 @@ static void backend_init(struct antispam_config *cfg,
        const char *tmp;
        int i;
 @@ -316,20 +324,50 @@ static void backend_init(struct antispam_config *cfg,
        const char *tmp;
        int i;
@@ -266,3 +641,37 @@ index 18c2233..a20b4aa 100644
        }
  
        tmp = getenv("PIPE_PROGRAM", getenv_data);
        }
  
        tmp = getenv("PIPE_PROGRAM", getenv_data);
+diff --git a/spool2dir.c b/spool2dir.c
+index cbd1909..d304716 100644
+--- a/spool2dir.c
++++ b/spool2dir.c
+@@ -165,7 +165,7 @@ static int backend_handle_mail(const struct antispam_config *cfg,
+               return -1;
+       }
+-      t_push();
++      T_BEGIN {
+       /* atomically create a _new_ file */
+       while (ast->count <= 9999) {
+@@ -174,9 +174,6 @@ static int backend_handle_mail(const struct antispam_config *cfg,
+               if (fd >= 0 || errno != EEXIST)
+                       break;
+               /* current filename in buf already exists, zap it */
+-              t_pop();
+-              t_push();
+-              /* buf is invalid now! */
+       }
+       if (fd < 0) {
+@@ -225,8 +222,8 @@ static int backend_handle_mail(const struct antispam_config *cfg,
+       close(fd);
+       if (ret)
+               unlink(buf);
+- out:
+-      t_pop();
++ out: ;
++      } T_END;
+       return ret;
+ }
index 396ba6b39f1bcf7047a2b5864ef86fba34457c6c..8302ba66b8745c0117f5174ebee8c2b450de364d 100644 (file)
@@ -2,14 +2,12 @@ Summary:      The dovecot antispam plugin
 Summary(pl.UTF-8):     Wtyczka antyspamowa dla dovecota
 Name:          dovecot-antispam
 Version:       2.0
 Summary(pl.UTF-8):     Wtyczka antyspamowa dla dovecota
 Name:          dovecot-antispam
 Version:       2.0
-Release:       32
+Release:       33
 License:       GPL v2
 Group:         Daemons
 Source0:       http://johannes.sipsolutions.net/download/dovecot-antispam/%{name}-%{version}.tar.bz2
 # Source0-md5: 14547898759fbd93f2b98304520decc6
 Patch0:                %{name}-git.patch
 License:       GPL v2
 Group:         Daemons
 Source0:       http://johannes.sipsolutions.net/download/dovecot-antispam/%{name}-%{version}.tar.bz2
 # Source0-md5: 14547898759fbd93f2b98304520decc6
 Patch0:                %{name}-git.patch
-Patch1:                dovecot-2.2.patch
-Patch2:                dovecot-2.2.14.patch
 URL:           http://johannes.sipsolutions.net/Projects/dovecot-antispam
 BuildRequires: dovecot-devel >= 1:2.0
 %requires_eq_to        dovecot dovecot-devel
 URL:           http://johannes.sipsolutions.net/Projects/dovecot-antispam
 BuildRequires: dovecot-devel >= 1:2.0
 %requires_eq_to        dovecot dovecot-devel
@@ -24,8 +22,6 @@ way it was moved).
 %prep
 %setup -q
 %patch0 -p1
 %prep
 %setup -q
 %patch0 -p1
-%patch1 -p1
-%patch2 -p1
 
 %build
 unset GIT_DIR
 
 %build
 unset GIT_DIR
This page took 0.127758 seconds and 4 git commands to generate.