Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-27 Thread Jakob Curdes

Eugene wrote (somte time ago, I am just now recollecting my threads):

Jakob Curdes wrote

Some weeks ago I asked a question on the antispam plugin; obviously
nobody could help me. I just worked on it again but made no progress.
Is actually anybody out there running the antispam plugin with dspam?? I
am willing to write a Wiki page for configuring this as soon as I get it
to work.
.
- as soon as I move a message into the spam folder it gives an error
message saying antispam signature not found


Just had this error myself. In my case, the cause was a large spam 
message (above the configured MaxMessageSize parameter for DSPAM) that 
was skipped during tests and thus no signature was added. Might this 
be true in your case?
Might be for some messages as I just detected that some messages have a 
signature and others don't.
BUT I also cannot move messages into spam that carry a signature. When I 
feed the message corpus on the command line it works, but not via the 
antispam plugin.





X-DSPAM-Signature: 1,49084a24139132188715614


Another guess: if that comma is not a misprint, something is wrong in 
your setup.
Why? Mine all look like that; are the signatures configurable somewhere 
in dspam?


JC


Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-27 Thread Thorsten Vollmer
On Thu, 2008-11-27 at 20:01 +0100, Jakob Curdes wrote:
 Eugene wrote (somte time ago, I am just now recollecting my threads):
  Jakob Curdes wrote
  Some weeks ago I asked a question on the antispam plugin; obviously
  nobody could help me. I just worked on it again but made no progress.
  Is actually anybody out there running the antispam plugin with dspam?? I
  am willing to write a Wiki page for configuring this as soon as I get it
  to work.
  .
  - as soon as I move a message into the spam folder it gives an error
  message saying antispam signature not found
 
  Just had this error myself. In my case, the cause was a large spam 
  message (above the configured MaxMessageSize parameter for DSPAM) that 
  was skipped during tests and thus no signature was added. Might this 
  be true in your case?
 Might be for some messages as I just detected that some messages have a 
 signature and others don't.
 BUT I also cannot move messages into spam that carry a signature. When I 
 feed the message corpus on the command line it works, but not via the 
 antispam plugin.
 
  X-DSPAM-Signature: 1,49084a24139132188715614
 
  Another guess: if that comma is not a misprint, something is wrong in 
  your setup.
 Why? Mine all look like that; are the signatures configurable somewhere 
 in dspam?

DSPAM's signature contains a comma if MySQLUIDInSignature is enabled.
That setting does not affect dovecot-antispam though.

Thorsten



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-15 Thread Guillaume HILT

Sounds like the training is working with your patch :
Nov 15 11:13:59 ks29138 imap: antispam: plugin initialising (1.1-notgit)
Nov 15 11:13:59 ks29138 imap: antispam: Trash is trash folder
Nov 15 11:13:59 ks29138 imap: antispam: Spam is spam folder
Nov 15 11:13:59 ks29138 imap: antispam: no unsure folders
Nov 15 11:13:59 ks29138 imap: antispam: dspam binary set to /usr/bin/dspam
Nov 15 11:13:59 ks29138 imap: antispam: signature header line is 
X-DSPAM-Signature
Nov 15 11:13:59 ks29138 imap: antispam: will silently move mails with 
missing signature

Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_unsure(Spam): 0
Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_trash(INBOX): 0
Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_trash(Spam): 0
Nov 15 13:05:37 ks29138 imap: antispam: mail copy: from trash: 0, to 
trash: 0

Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_spam(INBOX): 0
Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_spam(Spam): 1
Nov 15 13:05:37 ks29138 imap: antispam: mailbox_is_unsure(INBOX): 0
Nov 15 13:05:37 ks29138 imap: antispam: mail copy: src spam: 0, dst 
spam: 1, src unsure: 0
Nov 15 13:05:37 ks29138 imap: antispam: /usr/bin/dspam --source=error 
--class=spam --signature=491eb6f2313798800310897


And without the patch :

Nov 15 13:18:42 ks29138 imap: antispam: plugin initialising (1.1-3-g03a1d10)
Nov 15 13:18:42 ks29138 imap: antispam: Trash is trash folder
Nov 15 13:18:42 ks29138 imap: antispam: Spam is spam folder
Nov 15 13:18:42 ks29138 imap: antispam: no unsure folders
Nov 15 13:18:42 ks29138 imap: antispam: dspam binary set to /usr/bin/dspam
Nov 15 13:18:42 ks29138 imap: antispam: signature header line is 
X-DSPAM-Signature

Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_unsure(Spam): 0
Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_trash(INBOX): 0
Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_trash(Spam): 0
Nov 15 13:18:45 ks29138 imap: antispam: mail copy: from trash: 0, to 
trash: 0

Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_spam(INBOX): 0
Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_spam(Spam): 1
Nov 15 13:18:45 ks29138 imap: antispam: mailbox_is_unsure(INBOX): 0
Nov 15 13:18:45 ks29138 imap: antispam: mail copy: src spam: 0, dst 
spam: 1, src unsure: 0
Nov 15 13:18:45 ks29138 imap: antispam: /usr/bin/dspam --source=error 
--class=spam --signature=491eb6f2313798800310897


I tried with some new mails this time.

Guillaume HILT a écrit :

Not really, I haven't tried it with some new mails.
I had this problem with some old one I imported from my previous 
server (i used spamassassin and courier-imap).
I'll try to test the training and if it's not working, I'll revert to 
the svn version.
It's not a big deal anyway if I can't use some old mails to train the 
plugin.


Johannes Berg a écrit :

On Fri, 2008-11-14 at 16:53 +0100, Guillaume HILT wrote:
 

Ok, i updated the files by hand, and it's working like a charm :)
Thanks for the patch Johannes.



Umm, you realise that now it's not training at all, right? That's why
the docs there say don't use this patch unless you verified that it
works first. Unless you really had this problem only with some large
emails?

johannes
  




--
 Guillaume Hilt





Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-14 Thread Guillaume HILT



Johannes Berg a écrit :

On Tue, 2008-11-11 at 11:42 +0100, Johannes Berg wrote:

  

Not sure, I personally think that moving them silently makes errors
harder to diagnose. I'll add an option since then you can set this
option (antispam_missing_signature = [error|move]) to move after you've
tested and verified that it works just fine.



Try this patch please, I have only compiled it so far. (there might be
rejects in the signature-log.c file unless you update to the current git
tree but you don't care about that)

diff --git a/antispam.7 b/antispam.7
index d07c1d0..e26db69 100644
--- a/antispam.7
+++ b/antispam.7
@@ -108,6 +108,13 @@ plugin {
 # mail signature (used with any backend requiring a signature)
 antispam_signature = X-DSPAM-Signature
 
+# action to take on mails without signature

+# (used with any backend requiring a signature)
+# (we recommend only setting this to 'move' after verifying that the
+# whole setup is working)
+# antispam_signature_missing = move # move silently without training
+antispam_signature_missing = error
+
 # semicolon-separated list of Trash folders (default unset i.e. none)
 # antispam_trash =
 # antispam_trash = trash;Trash;Deleted Items
diff --git a/signature-log.c b/signature-log.c
index ab8cd6d..5b7b306 100644
--- a/signature-log.c
+++ b/signature-log.c
@@ -99,7 +99,12 @@ int backend_handle_mail(struct mailbox_transaction_context 
*t,
return -1;
}
 
-	signature = signature_extract(t, mail);

+   ret = signature_extract(t, mail, signature);
+   if (ret)
+   return ret;
+
+   if (!signature)
+   return 0;
 
 	switch (wanted) {

case CLASS_SPAM:
diff --git a/signature.c b/signature.c
index 7f9d83b..7ad29d6 100644
--- a/signature.c
+++ b/signature.c
@@ -5,6 +5,7 @@
 #include mail-storage-private.h
 
 const char *signature_hdr = X-DSPAM-Signature;

+static int signature_nosig_ignore = 0;
 
 void signature_init(void)

 {
@@ -12,6 +13,16 @@ void signature_init(void)
if (tmp)
signature_hdr = tmp;
debug(signature header line is \%s\\n, signature_hdr);
+
+   tmp = get_setting(SIGNATURE_MISSING);
+   if (!tmp)
+   tmp = error;
+   if (strcmp(tmp, move) == 0) {
+   signature_nosig_ignore = 1;
+   debug(will silently move mails with missing signature\n);
+   } else if (strcmp(tmp, error) != 0) {
+   debug(invalid signature_missing setting '%s', ignoring\n, 
tmp);
+   }
 }
 
 int signature_extract_to_list(struct mailbox_transaction_context *t,

@@ -23,10 +34,14 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
 
 	signatures = get_mail_headers(mail, signature_hdr);

if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return -1;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   return 0;
+   }
}
 
 	while (signatures[1])

@@ -42,23 +57,30 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
return 0;
 }
 
-const char *signature_extract(struct mailbox_transaction_context *t,

- struct mail *mail)
+int signature_extract(struct mailbox_transaction_context *t,
+ struct mail *mail, const char **signature)
 {
const char *const *signatures;
 
 	signatures = get_mail_headers(mail, signature_hdr);

if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return NULL;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   *signature = NULL;
+   return 0;
+   }
}
 
 	while (signatures[1])

signatures++;
 
-	return signatures[0];

+   *signature = signatures[0];
+
+   return 0;
 }
 
 void signature_list_free(struct siglist **list)

diff --git a/signature.h b/signature.h
index e25d1b5..1384924 100644
--- a/signature.h
+++ b/signature.h
@@ -16,8 +16,8 @@ void signature_init(void);
 int signature_extract_to_list(struct mailbox_transaction_context *t,
 

Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-14 Thread Guillaume HILT

I have the same problem and i'm wondering how should i use this patch ?
I'm not familiar with the patch command.

Thanks.

PS: Sorry for the empty mail

Johannes Berg a écrit 

On Tue, 2008-11-11 at 11:42 +0100, Johannes Berg wrote:

  

Not sure, I personally think that moving them silently makes errors
harder to diagnose. I'll add an option since then you can set this
option (antispam_missing_signature = [error|move]) to move after you've
tested and verified that it works just fine.



Try this patch please, I have only compiled it so far. (there might be
rejects in the signature-log.c file unless you update to the current git
tree but you don't care about that)

diff --git a/antispam.7 b/antispam.7
index d07c1d0..e26db69 100644
--- a/antispam.7
+++ b/antispam.7
@@ -108,6 +108,13 @@ plugin {
 # mail signature (used with any backend requiring a signature)
 antispam_signature = X-DSPAM-Signature
 
+# action to take on mails without signature

+# (used with any backend requiring a signature)
+# (we recommend only setting this to 'move' after verifying that the
+# whole setup is working)
+# antispam_signature_missing = move # move silently without training
+antispam_signature_missing = error
+
 # semicolon-separated list of Trash folders (default unset i.e. none)
 # antispam_trash =
 # antispam_trash = trash;Trash;Deleted Items
diff --git a/signature-log.c b/signature-log.c
index ab8cd6d..5b7b306 100644
--- a/signature-log.c
+++ b/signature-log.c
@@ -99,7 +99,12 @@ int backend_handle_mail(struct mailbox_transaction_context 
*t,
return -1;
}
 
-	signature = signature_extract(t, mail);

+   ret = signature_extract(t, mail, signature);
+   if (ret)
+   return ret;
+
+   if (!signature)
+   return 0;
 
 	switch (wanted) {

case CLASS_SPAM:
diff --git a/signature.c b/signature.c
index 7f9d83b..7ad29d6 100644
--- a/signature.c
+++ b/signature.c
@@ -5,6 +5,7 @@
 #include mail-storage-private.h
 
 const char *signature_hdr = X-DSPAM-Signature;

+static int signature_nosig_ignore = 0;
 
 void signature_init(void)

 {
@@ -12,6 +13,16 @@ void signature_init(void)
if (tmp)
signature_hdr = tmp;
debug(signature header line is \%s\\n, signature_hdr);
+
+   tmp = get_setting(SIGNATURE_MISSING);
+   if (!tmp)
+   tmp = error;
+   if (strcmp(tmp, move) == 0) {
+   signature_nosig_ignore = 1;
+   debug(will silently move mails with missing signature\n);
+   } else if (strcmp(tmp, error) != 0) {
+   debug(invalid signature_missing setting '%s', ignoring\n, 
tmp);
+   }
 }
 
 int signature_extract_to_list(struct mailbox_transaction_context *t,

@@ -23,10 +34,14 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
 
 	signatures = get_mail_headers(mail, signature_hdr);

if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return -1;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   return 0;
+   }
}
 
 	while (signatures[1])

@@ -42,23 +57,30 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
return 0;
 }
 
-const char *signature_extract(struct mailbox_transaction_context *t,

- struct mail *mail)
+int signature_extract(struct mailbox_transaction_context *t,
+ struct mail *mail, const char **signature)
 {
const char *const *signatures;
 
 	signatures = get_mail_headers(mail, signature_hdr);

if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return NULL;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   *signature = NULL;
+   return 0;
+   }
}
 
 	while (signatures[1])

signatures++;
 
-	return signatures[0];

+   *signature = signatures[0];
+
+   return 0;
 }
 
 void signature_list_free(struct siglist **list)

diff --git a/signature.h b/signature.h
index e25d1b5..1384924 100644
--- a/signature.h
+++ 

Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-14 Thread Guillaume HILT

Ok, i updated the files by hand, and it's working like a charm :)
Thanks for the patch Johannes.

Guillaume HILT a écrit :

I have the same problem and i'm wondering how should i use this patch ?
I'm not familiar with the patch command.

Thanks.

PS: Sorry for the empty mail

Johannes Berg a écrit

On Tue, 2008-11-11 at 11:42 +0100, Johannes Berg wrote:

 

Not sure, I personally think that moving them silently makes errors
harder to diagnose. I'll add an option since then you can set this
option (antispam_missing_signature = [error|move]) to move after you've
tested and verified that it works just fine.



Try this patch please, I have only compiled it so far. (there might be
rejects in the signature-log.c file unless you update to the current git
tree but you don't care about that)

diff --git a/antispam.7 b/antispam.7
index d07c1d0..e26db69 100644
--- a/antispam.7
+++ b/antispam.7
@@ -108,6 +108,13 @@ plugin {
 # mail signature (used with any backend requiring a signature)
 antispam_signature = X-DSPAM-Signature
 
+# action to take on mails without signature

+# (used with any backend requiring a signature)
+# (we recommend only setting this to 'move' after verifying that 
the

+# whole setup is working)
+# antispam_signature_missing = move # move silently without 
training

+antispam_signature_missing = error
+
 # semicolon-separated list of Trash folders (default unset i.e. 
none)

 # antispam_trash =
 # antispam_trash = trash;Trash;Deleted Items
diff --git a/signature-log.c b/signature-log.c
index ab8cd6d..5b7b306 100644
--- a/signature-log.c
+++ b/signature-log.c
@@ -99,7 +99,12 @@ int backend_handle_mail(struct 
mailbox_transaction_context *t,

 return -1;
 }
 
-signature = signature_extract(t, mail);

+ret = signature_extract(t, mail, signature);
+if (ret)
+return ret;
+
+if (!signature)
+return 0;
 
 switch (wanted) {

 case CLASS_SPAM:
diff --git a/signature.c b/signature.c
index 7f9d83b..7ad29d6 100644
--- a/signature.c
+++ b/signature.c
@@ -5,6 +5,7 @@
 #include mail-storage-private.h
 
 const char *signature_hdr = X-DSPAM-Signature;

+static int signature_nosig_ignore = 0;
 
 void signature_init(void)

 {
@@ -12,6 +13,16 @@ void signature_init(void)
 if (tmp)
 signature_hdr = tmp;
 debug(signature header line is \%s\\n, signature_hdr);
+
+tmp = get_setting(SIGNATURE_MISSING);
+if (!tmp)
+tmp = error;
+if (strcmp(tmp, move) == 0) {
+signature_nosig_ignore = 1;
+debug(will silently move mails with missing signature\n);
+} else if (strcmp(tmp, error) != 0) {
+debug(invalid signature_missing setting '%s', ignoring\n, 
tmp);

+}
 }
 
 int signature_extract_to_list(struct mailbox_transaction_context *t,
@@ -23,10 +34,14 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
 
 signatures = get_mail_headers(mail, signature_hdr);

 if (!signatures || !signatures[0]) {
-mail_storage_set_error(t-box-storage,
-   ME(NOTPOSSIBLE)
-   antispam signature not found);
-return -1;
+if (!signature_nosig_ignore) {
+mail_storage_set_error(t-box-storage,
+   ME(NOTPOSSIBLE)
+   antispam signature not found);
+return -1;
+} else {
+return 0;
+}
 }
 
 while (signatures[1])
@@ -42,23 +57,30 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,

 return 0;
 }
 
-const char *signature_extract(struct mailbox_transaction_context *t,

-  struct mail *mail)
+int signature_extract(struct mailbox_transaction_context *t,
+  struct mail *mail, const char **signature)
 {
 const char *const *signatures;
 
 signatures = get_mail_headers(mail, signature_hdr);

 if (!signatures || !signatures[0]) {
-mail_storage_set_error(t-box-storage,
-   ME(NOTPOSSIBLE)
-   antispam signature not found);
-return NULL;
+if (!signature_nosig_ignore) {
+mail_storage_set_error(t-box-storage,
+   ME(NOTPOSSIBLE)
+   antispam signature not found);
+return -1;
+} else {
+*signature = NULL;
+return 0;
+}
 }
 
 while (signatures[1])

 signatures++;
 
-return signatures[0];

+*signature = signatures[0];
+
+return 0;
 }
 
 void signature_list_free(struct siglist **list)

diff --git a/signature.h b/signature.h
index e25d1b5..1384924 100644
--- a/signature.h
+++ b/signature.h
@@ -16,8 +16,8 @@ void signature_init(void);
 int signature_extract_to_list(struct mailbox_transaction_context *t,
   struct mail *mail, struct siglist **list,
   enum classification wanted);
-const char *signature_extract(struct 

Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-14 Thread Guillaume HILT

Not really, I haven't tried it with some new mails.
I had this problem with some old one I imported from my previous server 
(i used spamassassin and courier-imap).
I'll try to test the training and if it's not working, I'll revert to 
the svn version.
It's not a big deal anyway if I can't use some old mails to train the 
plugin.


Johannes Berg a écrit :

On Fri, 2008-11-14 at 16:53 +0100, Guillaume HILT wrote:
  

Ok, i updated the files by hand, and it's working like a charm :)
Thanks for the patch Johannes.



Umm, you realise that now it's not training at all, right? That's why
the docs there say don't use this patch unless you verified that it
works first. Unless you really had this problem only with some large
emails?

johannes
  


--
 Guillaume Hilt




Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-11 Thread Johannes Berg
On Tue, 2008-11-11 at 11:42 +0100, Johannes Berg wrote:

 Not sure, I personally think that moving them silently makes errors
 harder to diagnose. I'll add an option since then you can set this
 option (antispam_missing_signature = [error|move]) to move after you've
 tested and verified that it works just fine.

Try this patch please, I have only compiled it so far. (there might be
rejects in the signature-log.c file unless you update to the current git
tree but you don't care about that)

diff --git a/antispam.7 b/antispam.7
index d07c1d0..e26db69 100644
--- a/antispam.7
+++ b/antispam.7
@@ -108,6 +108,13 @@ plugin {
 # mail signature (used with any backend requiring a signature)
 antispam_signature = X-DSPAM-Signature
 
+# action to take on mails without signature
+# (used with any backend requiring a signature)
+# (we recommend only setting this to 'move' after verifying that the
+# whole setup is working)
+# antispam_signature_missing = move # move silently without training
+antispam_signature_missing = error
+
 # semicolon-separated list of Trash folders (default unset i.e. none)
 # antispam_trash =
 # antispam_trash = trash;Trash;Deleted Items
diff --git a/signature-log.c b/signature-log.c
index ab8cd6d..5b7b306 100644
--- a/signature-log.c
+++ b/signature-log.c
@@ -99,7 +99,12 @@ int backend_handle_mail(struct mailbox_transaction_context 
*t,
return -1;
}
 
-   signature = signature_extract(t, mail);
+   ret = signature_extract(t, mail, signature);
+   if (ret)
+   return ret;
+
+   if (!signature)
+   return 0;
 
switch (wanted) {
case CLASS_SPAM:
diff --git a/signature.c b/signature.c
index 7f9d83b..7ad29d6 100644
--- a/signature.c
+++ b/signature.c
@@ -5,6 +5,7 @@
 #include mail-storage-private.h
 
 const char *signature_hdr = X-DSPAM-Signature;
+static int signature_nosig_ignore = 0;
 
 void signature_init(void)
 {
@@ -12,6 +13,16 @@ void signature_init(void)
if (tmp)
signature_hdr = tmp;
debug(signature header line is \%s\\n, signature_hdr);
+
+   tmp = get_setting(SIGNATURE_MISSING);
+   if (!tmp)
+   tmp = error;
+   if (strcmp(tmp, move) == 0) {
+   signature_nosig_ignore = 1;
+   debug(will silently move mails with missing signature\n);
+   } else if (strcmp(tmp, error) != 0) {
+   debug(invalid signature_missing setting '%s', ignoring\n, 
tmp);
+   }
 }
 
 int signature_extract_to_list(struct mailbox_transaction_context *t,
@@ -23,10 +34,14 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
 
signatures = get_mail_headers(mail, signature_hdr);
if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return -1;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   return 0;
+   }
}
 
while (signatures[1])
@@ -42,23 +57,30 @@ int signature_extract_to_list(struct 
mailbox_transaction_context *t,
return 0;
 }
 
-const char *signature_extract(struct mailbox_transaction_context *t,
- struct mail *mail)
+int signature_extract(struct mailbox_transaction_context *t,
+ struct mail *mail, const char **signature)
 {
const char *const *signatures;
 
signatures = get_mail_headers(mail, signature_hdr);
if (!signatures || !signatures[0]) {
-   mail_storage_set_error(t-box-storage,
-  ME(NOTPOSSIBLE)
-  antispam signature not found);
-   return NULL;
+   if (!signature_nosig_ignore) {
+   mail_storage_set_error(t-box-storage,
+  ME(NOTPOSSIBLE)
+  antispam signature not found);
+   return -1;
+   } else {
+   *signature = NULL;
+   return 0;
+   }
}
 
while (signatures[1])
signatures++;
 
-   return signatures[0];
+   *signature = signatures[0];
+
+   return 0;
 }
 
 void signature_list_free(struct siglist **list)
diff --git a/signature.h b/signature.h
index e25d1b5..1384924 100644
--- a/signature.h
+++ b/signature.h
@@ -16,8 +16,8 @@ void signature_init(void);
 int signature_extract_to_list(struct mailbox_transaction_context *t,
  

Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-11 Thread Johannes Berg
On Tue, 2008-11-11 at 01:04 +0100, Eugene wrote:

 Just had this error myself. In my case, the cause was a large spam message 
 (above the configured MaxMessageSize parameter for DSPAM) that was skipped 
 during tests and thus no signature was added. Might this be true in your 
 case?
 
 As a general suggestion for Johannes: maybe it is better to ignore this 
 error silently, just move the message and don't call DSPAM?

Not sure, I personally think that moving them silently makes errors
harder to diagnose. I'll add an option since then you can set this
option (antispam_missing_signature = [error|move]) to move after you've
tested and verified that it works just fine.

johannes


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-10 Thread Eugene

Jakob Curdes wrote

Some weeks ago I asked a question on the antispam plugin; obviously
nobody could help me. I just worked on it again but made no progress.
Is actually anybody out there running the antispam plugin with dspam?? I
am willing to write a Wiki page for configuring this as soon as I get it
to work.
.
- as soon as I move a message into the spam folder it gives an error
message saying antispam signature not found


Just had this error myself. In my case, the cause was a large spam message 
(above the configured MaxMessageSize parameter for DSPAM) that was skipped 
during tests and thus no signature was added. Might this be true in your 
case?


As a general suggestion for Johannes: maybe it is better to ignore this 
error silently, just move the message and don't call DSPAM?



I checked that the given location for the dspam executable is correct,
that the user executing it (dovecot?) is actually able to execute dspam
and that dspam trusts this user. I triple-checked that the signature is
configured correctly. I have lines like



X-DSPAM-Signature: 1,49084a24139132188715614


Another guess: if that comma is not a misprint, something is wrong in your 
setup.


Regards
Eugene 



Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-09 Thread Jakob Curdes
Some weeks ago I asked a question on the antispam plugin; obviously 
nobody could help me. I just worked on it again but made no progress.
Is actually anybody out there running the antispam plugin with dspam?? I 
am willing to write a Wiki page for configuring this as soon as I get it 
to work.


The problem still remains and the outlines are:

- antispam plugin is compiled, configured for dspam and debug is 
switched on.
- plugin starts with dovecot and throws debug info to /var/log/messages 
(debug logging activated via syslog)
- as soon as I move a message into the spam folder it gives an error 
message saying antispam signature not found


I checked that the given location for the dspam executable is correct, 
that the user executing it (dovecot?) is actually able to execute dspam 
and that dspam trusts this user. I triple-checked that the signature is 
configured correctly. I have lines like


X-DSPAM-Signature: 1,49084a24139132188715614 


in all mails  and my plugin conf says

   # mail signature (used with any backend requiring a signature)

   antispam_signature = X-DSPAM-Signature

I do not get any error messages in the debug output, only dovecot says:
dovecot: Nov 09 13:19:40 Error: IMAP(): Next message unexpectedly 
lost from 49


Any ideas? How can I get a more specific debugging for the signature? Or 
might this still be a permission problem?


Here is my plugin config:

# antispam plugin - learn spam from folder
   antispam_signature = X-DSPAM-Signature
   antispam_spam = spam
   antispam_dspam_binary = /usr/local/bin/dspam


Regards, Jakob


Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-09 Thread Elisamuel Resto
On Sunday 09 November 2008, Jakob Curdes wrote:
 Some weeks ago I asked a question on the antispam plugin; obviously
 nobody could help me. I just worked on it again but made no progress.
 Is actually anybody out there running the antispam plugin with dspam?? I
 am willing to write a Wiki page for configuring this as soon as I get it
 to work.

 The problem still remains and the outlines are:

 - antispam plugin is compiled, configured for dspam and debug is
 switched on.
 - plugin starts with dovecot and throws debug info to /var/log/messages
 (debug logging activated via syslog)
 - as soon as I move a message into the spam folder it gives an error
 message saying antispam signature not found

 I checked that the given location for the dspam executable is correct,
 that the user executing it (dovecot?) is actually able to execute dspam
 and that dspam trusts this user. I triple-checked that the signature is
 configured correctly. I have lines like

 X-DSPAM-Signature: 1,49084a24139132188715614

 in all mails  and my plugin conf says

 # mail signature (used with any backend requiring a signature)

 antispam_signature = X-DSPAM-Signature

 I do not get any error messages in the debug output, only dovecot says:
 dovecot: Nov 09 13:19:40 Error: IMAP(): Next message unexpectedly
 lost from 49

 Any ideas? How can I get a more specific debugging for the signature? Or
 might this still be a permission problem?

 Here is my plugin config:

 # antispam plugin - learn spam from folder
 antispam_signature = X-DSPAM-Signature
 antispam_spam = spam
 antispam_dspam_binary = /usr/local/bin/dspam


 Regards, Jakob

Personally, I don't set anything but the spam folder, trash folder names and 
the 
args to pass to the dspam executable. It works here flawlessly.

plugins {
  antispam_trash = trash;Trash;Deleted Items
  antispam_spam = SPAM;Spam;Junk
  antispam_dspam_args = --client;--deliver=;--user;%u
}

-- 
Elisamuel Resto [EMAIL PROTECTED]
Source Mage Tome Lead  / http://sourcemage.org
GPG ID: 18615F19/1024D / http://simplysam.us



Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-09 Thread Jakob Curdes



plugins {
  antispam_trash = trash;Trash;Deleted Items
  antispam_spam = SPAM;Spam;Junk
  antispam_dspam_args = --client;--deliver=;--user;%u
  
I am using dspam in a different setup; I run it under amavis so the user 
is always the user amavis. I don't run a daemon so --client makes no 
sense. What does deliver= do? Is that the same as 
deliver=innocent,spam ?


I think it must be related to permissions in some way but I do not see 
how. I would like to debug it further but am no C programmer. I cannot 
see why it is not able to extract the signature.


JC


Re: [Dovecot] antispam plugin claims antispam signature not found

2008-11-09 Thread Elisamuel Resto
On Sunday 09 November 2008, Jakob Curdes wrote:
  plugins {
antispam_trash = trash;Trash;Deleted Items
antispam_spam = SPAM;Spam;Junk
antispam_dspam_args = --client;--deliver=;--user;%u

 I am using dspam in a different setup; I run it under amavis so the user
 is always the user amavis. I don't run a daemon so --client makes no
 sense. What does deliver= do? Is that the same as
 deliver=innocent,spam ?

 I think it must be related to permissions in some way but I do not see
 how. I would like to debug it further but am no C programmer. I cannot
 see why it is not able to extract the signature.

 JC

Yes, you are correct about not needing '--client' in your case. '--deliver=' 
means 
deliver nothing, just process it. Since I don't use quarantine on my setup, and 
the message is existent already in IMAP, there is no need to deliver anything.

-- 
Elisamuel Resto [EMAIL PROTECTED]
Source Mage General Guru / http://sourcemage.org
GPG ID: 18615F19/1024D   / http://simplysam.us