[Dovecot] Antispam folder names

Andreas Jobs andreas.jobs+dovecot at ruhr-uni-bochum.de
Mon Aug 5 13:45:05 EEST 2013


On Thu, Aug 01, 2013 at 10:31:02AM +0200, Jost Krieger wrote:
> 1. We needed to fix UTF-8 handling in the plugin, so that we kow canb
>    say
> 
>    antispam_trash_pattern_ignorecase = gelöscht*
> 
>    in place of
>
>    antispam_trash_pattern_ignorecase = gel&APY-scht*

dovecot-antispam-utf8-logging.patch contains a patch for that (and adds
some logging).

The second patch (dovecot-antispam-configure.patch) fixes only a minor
problem that I had with the configure script.


--Andreas
-- 
! Andreas Jobs                                  Network Operation Center !
!                                               Ruhr-Universitaet Bochum !
! One Day I Will Find This Peer Guy and Then I Will Reset HIS Connection !
-------------- next part --------------
diff -r 5ebc6aae4d7c configure.ac
--- a/configure.ac	Mon Apr 29 14:59:26 2013 +0200
+++ b/configure.ac	Mon Aug 05 11:24:45 2013 +0200
@@ -17,9 +17,11 @@
 AC_CONFIG_HEADERS(config.h)
 
 DC_DOVECOT
+CFLAGS="$DOVECOT_CFLAGS"
+LIBS="$DOVECOT_LIBS"
 
 AC_MSG_CHECKING([for dovecot tree type])
-if test x$LIBDOVECOT_STORAGE_DEPS != x; then
+if test x"$LIBDOVECOT_STORAGE_DEPS" != x""; then
     AC_MSG_RESULT([build])
     AC_ERROR([Please install dovecot first and use that tree instead.])
 fi
-------------- next part --------------
diff -r 5ebc6aae4d7c src/mailbox.c
--- a/src/mailbox.c	Mon Apr 29 14:59:26 2013 +0200
+++ b/src/mailbox.c	Mon Aug 05 11:24:45 2013 +0200
@@ -3,6 +3,7 @@
 #include "user.h"
 #include "mailbox.h"
 #include "backends.h"
+#include "str-sanitize.h"
 
 static MODULE_CONTEXT_DEFINE_INIT(antispam_storage_module,
 	&mail_storage_module_register);
@@ -10,6 +11,7 @@
 	&mail_storage_module_register);
 
 #define TRANSACTION_CONTEXT(obj) MODULE_CONTEXT(obj, antispam_transaction_module)
+#define MAILBOX_NAME_LOG_LEN 64
 
 struct antispam_transaction
 {
@@ -27,7 +29,7 @@
 
 static enum mailbox_class antispam_mailbox_classify(struct mailbox *box)
 {
-    const char *name = mailbox_get_name(box);
+    const char *name = mailbox_get_vname(box);
     struct antispam_user *asu = USER_CONTEXT(box->storage->user);
     enum match_type i;
     char **iter;
@@ -107,22 +109,35 @@
     enum mailbox_copy_type copy_type =
 	    antispam_classify_copy(asms->box_class, asmb->box_class);
 
+#define LOG_COPYTYPE(ct) \
+    i_info("antispam: copytype for '%s' -> '%s' is %s",  \
+		    str_sanitize(mailbox_get_vname(mail->box), MAILBOX_NAME_LOG_LEN), \
+		    str_sanitize(mailbox_get_vname(t->box), MAILBOX_NAME_LOG_LEN), \
+		    (ct));
+
     switch (copy_type)
     {
 	case MCT_HAM:
+	    LOG_COPYTYPE("HAM");
+	    /* will continue processing further in this function */
+	    break;
 	case MCT_SPAM:
+	    LOG_COPYTYPE("SPAM");
 	    /* will continue processing further in this function */
 	    break;
 	case MCT_IGNORE:
+	    LOG_COPYTYPE("IGNORE");
 	    return asmb->module_ctx.super.copy(ctx, mail);
 	    break;
 	case MCT_DENY:
+	    LOG_COPYTYPE("DENY");
 	    mail_storage_set_error(t->box->storage, MAIL_ERROR_NOTPOSSIBLE,
 		    "This type of copy is forbidden");
 	    return -1;
 	    break;
     }
 
+#undef LOG_COPYTYPE
     if (asmb->module_ctx.super.copy(ctx, mail) != 0)
 	return -1;
 


More information about the dovecot mailing list