Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

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

  Thanks, I've added the Makefile patch, but the other one I'm not too
  sure about, it seems it would print things twice if the loop actually
  looped, so I left it for now. Also, your code can access
  buf[sizeof(buf)] which would be a buffer overrun.
 
 My idea was that if the loop actually loops (i.e. more that 1024 bytes 
 returned), we just log several lines in debug log.
 Sorry for buffer overrun, we have to check readsize of course.
 Or just pass sizeof(buf)-1 to read()

Yeah, somehow I got confused, I've added this now.

johannes


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


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-10 Thread Eugene

Hi  Johannes,

From: Johannes Berg [EMAIL PROTECTED]


 Do you plan to implement 'out of band' dspam calling?
 BTW maybe there is no need for a separate 'queue' folder especially as 
 we
 only need a message signature. I think it can be stored in some buffer 
 array

 so as the dspam calls are made i.e. during idle time (or during final
 cleanup at the latest).



Well, I tried doing that with the signature-log backend, but that seemed
somewhat problematic to me although somebody said it actually works for
him.


Well, the performance of current approach seems acceptable, so it is 
probably not worth the trouble.




Thanks, I've added the Makefile patch, but the other one I'm not too
sure about, it seems it would print things twice if the loop actually
looped, so I left it for now. Also, your code can access
buf[sizeof(buf)] which would be a buffer overrun.


My idea was that if the loop actually loops (i.e. more that 1024 bytes 
returned), we just log several lines in debug log.

Sorry for buffer overrun, we have to check readsize of course.
Or just pass sizeof(buf)-1 to read()

Eugene 



Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Johannes Berg
On Wed, 2008-11-05 at 10:03 -0500, Rob Klingsten wrote:
 Hi folks -
 
 I am configuring a new system and the antispam plugin is the last piece 
 I need, everything else is working. Thanks to Johannes for this plugin, 
 it's exactly what I want and an elegant solution for filter training. 
 But I've been trying everything I can think of for the last 3 days to 
 get this to work, no success.
 
 I've got: Postfix 2.5.3, dspam 3.8.0, Dovecot 1.1.6, Maildrop 2.0.4 and 
 dovecot-antispam 1.0 tarball.  I've built dspam from source with 
 --disable-trusted-user-security to try and isolate the source of the 
 plugin problem, which is the message at the IMAP client Failed to call 
 dspam.
 
 Here's what I've got configured for the plugin:

hmm. I wonder if there's a bug in debugv(), can you comment that call
out in dspam-exec.c?

johannes


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


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Rob Klingsten



Johannes Berg wrote:

On Wed, 2008-11-05 at 10:03 -0500, Rob Klingsten wrote:

Hi folks -

I am configuring a new system and the antispam plugin is the last piece 
I need, everything else is working. Thanks to Johannes for this plugin, 
it's exactly what I want and an elegant solution for filter training. 
But I've been trying everything I can think of for the last 3 days to 
get this to work, no success.


I've got: Postfix 2.5.3, dspam 3.8.0, Dovecot 1.1.6, Maildrop 2.0.4 and 
dovecot-antispam 1.0 tarball.  I've built dspam from source with 
--disable-trusted-user-security to try and isolate the source of the 
plugin problem, which is the message at the IMAP client Failed to call 
dspam.


Here's what I've got configured for the plugin:


hmm. I wonder if there's a bug in debugv(), can you comment that call
out in dspam-exec.c?

johannes


Aha, that's getting closer ... I still got the 'Failed to call dspam' 
message, but dspam now seems to be called:


.
.
Nov  5 10:11:01 venus imap: antispam: Spam is spam folder
Nov  5 10:11:01 venus imap: antispam: no unsure folders
Nov  5 10:11:01 venus imap: antispam: dspam binary set to 
/usr/local/bin/dspam

Nov  5 10:11:01 venus imap: antispam: dspam extra arg --user [EMAIL PROTECTED]
Nov  5 10:11:01 venus dovecot: IMAP([EMAIL PROTECTED]): maildir: 
data=/var/mail/janeandrob.org/rob
Nov  5 10:11:01 venus dovecot: IMAP([EMAIL PROTECTED]): maildir++: 
root=/var/mail/.org/rob, index=, control=, inbox=/var/mail/.org/rob
Nov  5 10:11:01 venus imap: antispam: signature header line is 
X-DSPAM-Signature

Nov  5 10:11:05 venus imap: antispam: mailbox_is_unsure(Spam): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_trash(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_trash(Spam): 0
Nov  5 10:11:05 venus imap: antispam: mail copy: from trash: 0, to trash: 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_spam(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_spam(Spam): 1
Nov  5 10:11:05 venus imap: antispam: mailbox_is_unsure(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mail copy: src spam: 0, dst spam: 
1, src unsure: 0

Nov  5 10:11:05 venus dspam[834]: Unable to determine the destination user
Nov  5 10:11:05 venus dspam[834]: DSPAM agent misconfigured: aborting

So now what happened to the arguments to dspam? Thanks very much for the 
help!


Rob Klingsten


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Thorsten Vollmer
On Wed, 2008-11-05 at 10:03 -0500, Rob Klingsten wrote:
 Hi folks -
 
 I am configuring a new system and the antispam plugin is the last piece 
 I need, everything else is working. Thanks to Johannes for this plugin, 
 it's exactly what I want and an elegant solution for filter training. 
 But I've been trying everything I can think of for the last 3 days to 
 get this to work, no success.
 
 I've got: Postfix 2.5.3, dspam 3.8.0, Dovecot 1.1.6, Maildrop 2.0.4 and 
 dovecot-antispam 1.0 tarball.  I've built dspam from source with 
 --disable-trusted-user-security to try and isolate the source of the 
 plugin problem, which is the message at the IMAP client Failed to call 
 dspam.
 
 Here's what I've got configured for the plugin:
 
 antispam_signature = X-DSPAM-Signature
 antispam_trash = trash;Trash;Deleted Items;Deleted Messages
 antispam_spam = SPAM;Spam
 antispam_dspam_binary = /usr/local/bin/dspam
 antispam_dspam_args = --user %u

Does adding a semicolon help?

antispam_dspam_args = --user;%u

 And here's what happens:
 
 Nov  5 09:31:29 venus imap: antispam: plugin initialising (1.0-notgit)
 Nov  5 09:31:29 venus imap: antispam: trash is trash folder
 Nov  5 09:31:29 venus imap: antispam: Trash is trash folder
 Nov  5 09:31:29 venus imap: antispam: Deleted Items is trash folder
 Nov  5 09:31:29 venus imap: antispam: Deleted Messages is trash folder
 Nov  5 09:31:29 venus imap: antispam: SPAM is spam folder
 Nov  5 09:31:29 venus imap: antispam: Spam is spam folder
 Nov  5 09:31:29 venus imap: antispam: no unsure folders
 Nov  5 09:31:29 venus imap: antispam: dspam binary set to 
 /usr/local/bin/dspam
 Nov  5 09:31:29 venus imap: antispam: dspam extra arg --user dump-capability
 Nov  5 09:31:29 venus imap: antispam: signature header line is 
 X-DSPAM-Signature
 Nov  5 09:31:29 venus dovecot: Dovecot v1.1.6 starting up
 Nov  5 09:31:29 venus dovecot: auth-worker(default): mysql: Connected to 
 127.0.0.1 (postfix)
 Nov  5 09:31:30 venus dovecot: auth(default): new auth connection: pid=686
 Nov  5 09:31:30 venus dovecot: auth(default): new auth connection: pid=687
 Nov  5 09:31:30 venus dovecot: auth(default): new auth connection: pid=688
 Nov  5 09:32:45 venus dovecot: auth(default): client in: AUTH   1 
 PLAIN   service=imaplip=   rip= lport=143 rport=55904
 Nov  5 09:32:45 venus dovecot: auth(default): client out: CONT  1
 Nov  5 09:32:45 venus dovecot: auth(default): client in: CONThidden
 Nov  5 09:32:45 venus dovecot: auth-worker(default): 
 sql([EMAIL PROTECTED],): query: SELECT password, email AS user FROM users 
 WHERE email = '[EMAIL PROTECTED]';
 Nov  5 09:32:45 venus dovecot: auth(default): client out: OK1 
 [EMAIL PROTECTED]
 Nov  5 09:32:45 venus dovecot: auth(default): master in: REQUEST 
 1   688 1
 Nov  5 09:32:45 venus dovecot: auth(default): master out: USER  1 
 [EMAIL PROTECTED]  uid=5000gid=5000 
 home=/var/mail/.org/rob
 Nov  5 09:32:45 venus dovecot: imap-login: Login: user=[EMAIL PROTECTED], 
 method=PLAIN, rip=, lip=
 Nov  5 09:32:45 venus dovecot: auth(default): new auth connection: pid=688
 Nov  5 09:32:45 venus dovecot: IMAP([EMAIL PROTECTED]): Loading modules from 
 directory: /usr/lib/dovecot/imap
 Nov  5 09:32:45 venus dovecot: IMAP([EMAIL PROTECTED]): Module loaded: 
 /usr/lib/dovecot/imap/lib90_antispam_plugin.so
 Nov  5 09:32:45 venus dovecot: IMAP([EMAIL PROTECTED]): Effective uid=5000, 
 gid=5000, home=/var/mail/.org/rob
 Nov  5 09:32:45 venus imap: antispam: plugin initialising (1.0-notgit)
 Nov  5 09:32:45 venus imap: antispam: trash is trash folder
 Nov  5 09:32:45 venus imap: antispam: Trash is trash folder
 Nov  5 09:32:45 venus imap: antispam: Deleted Items is trash folder
 Nov  5 09:32:45 venus imap: antispam: Deleted Messages is trash folder
 Nov  5 09:32:45 venus imap: antispam: SPAM is spam folder
 Nov  5 09:32:45 venus imap: antispam: Spam is spam folder
 Nov  5 09:32:45 venus imap: antispam: no unsure folders
 Nov  5 09:32:45 venus imap: antispam: dspam binary set to 
 /usr/local/bin/dspam
 Nov  5 09:32:45 venus imap: antispam: dspam extra arg --user [EMAIL PROTECTED]
 Nov  5 09:32:45 venus dovecot: IMAP([EMAIL PROTECTED]): maildir: 
 data=/var/mail/.org/rob
 Nov  5 09:32:45 venus dovecot: IMAP([EMAIL PROTECTED]): maildir++: 
 root=/var/mail/.org/rob, index=, control=, inbox=/var/mail/.org/rob
 Nov  5 09:32:45 venus imap: antispam: signature header line is 
 X-DSPAM-Signature
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_unsure(Spam): 0
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_trash(INBOX): 0
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_trash(Spam): 0
 Nov  5 09:32:45 venus imap: antispam: mail copy: from trash: 0, to trash: 0
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_spam(INBOX): 0
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_spam(Spam): 1
 Nov  5 09:32:45 venus imap: antispam: mailbox_is_unsure(INBOX): 0
 Nov  5 09:32:45 venus imap: antispam: mail 

Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Rob Klingsten

Johannes Berg wrote:

On Wed, 2008-11-05 at 10:03 -0500, Rob Klingsten wrote:

Hi folks -

I am configuring a new system and the antispam plugin is the last 
piece I need, everything else is working. Thanks to Johannes for this 
plugin, it's exactly what I want and an elegant solution for filter 
training. But I've been trying everything I can think of for the last 
3 days to get this to work, no success.


I've got: Postfix 2.5.3, dspam 3.8.0, Dovecot 1.1.6, Maildrop 2.0.4 
and dovecot-antispam 1.0 tarball.  I've built dspam from source with 
--disable-trusted-user-security to try and isolate the source of the 
plugin problem, which is the message at the IMAP client Failed to 
call dspam.


Here's what I've got configured for the plugin:


hmm. I wonder if there's a bug in debugv(), can you comment that call
out in dspam-exec.c?

johannes


Aha, that's getting closer ... I still got the 'Failed to call dspam' 
message, but dspam now seems to be called:


.
.
Nov  5 10:11:01 venus imap: antispam: Spam is spam folder
Nov  5 10:11:01 venus imap: antispam: no unsure folders
Nov  5 10:11:01 venus imap: antispam: dspam binary set to 
/usr/local/bin/dspam

Nov  5 10:11:01 venus imap: antispam: dspam extra arg --user [EMAIL PROTECTED]
Nov  5 10:11:01 venus dovecot: IMAP([EMAIL PROTECTED]): maildir: 
data=/var/mail/janeandrob.org/rob
Nov  5 10:11:01 venus dovecot: IMAP([EMAIL PROTECTED]): maildir++: 
root=/var/mail/.org/rob, index=, control=, inbox=/var/mail/.org/rob
Nov  5 10:11:01 venus imap: antispam: signature header line is 
X-DSPAM-Signature

Nov  5 10:11:05 venus imap: antispam: mailbox_is_unsure(Spam): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_trash(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_trash(Spam): 0
Nov  5 10:11:05 venus imap: antispam: mail copy: from trash: 0, to trash: 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_spam(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mailbox_is_spam(Spam): 1
Nov  5 10:11:05 venus imap: antispam: mailbox_is_unsure(INBOX): 0
Nov  5 10:11:05 venus imap: antispam: mail copy: src spam: 0, dst spam: 
1, src unsure: 0

Nov  5 10:11:05 venus dspam[834]: Unable to determine the destination user
Nov  5 10:11:05 venus dspam[834]: DSPAM agent misconfigured: aborting

So now what happened to the arguments to dspam? Thanks very much for the 
help!


Ok, I got it, it works!  The primary solution was to comment out 
debugv() in dspam-exec.c ...


Then, as suggested I put back in the semicolon in my extra arguments to 
dspam and bingo!


Thanks very much to Johannes and Thorsten V. for the suggestions and 
speedy solution!


Rob Klingsten


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Johannes Berg
On Wed, 2008-11-05 at 10:25 -0500, Rob Klingsten wrote:

  hmm. I wonder if there's a bug in debugv(), can you comment that call
  out in dspam-exec.c?
 
  johannes
  
  Aha, that's getting closer ... I still got the 'Failed to call dspam' 
  message, but dspam now seems to be called:

  Nov  5 10:11:05 venus dspam[834]: DSPAM agent misconfigured: aborting
  
  So now what happened to the arguments to dspam? Thanks very much for the 
  help!
 
 Ok, I got it, it works!  The primary solution was to comment out 
 debugv() in dspam-exec.c ...
 
 Then, as suggested I put back in the semicolon in my extra arguments to 
 dspam and bingo!

:)

I just committed a fix to debugv(), can you try that? If you downloaded
the tarball, get this one:
http://git.sipsolutions.net/?p=dovecot-antispam.git;a=snapshot;h=HEAD;sf=tgz

If you can confirm that works I'll make a new release.

johannes


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


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Rob Klingsten

On Wed, 2008-11-05 at 10:25 -0500, Rob Klingsten wrote:


hmm. I wonder if there's a bug in debugv(), can you comment that call
out in dspam-exec.c?

johannes
Aha, that's getting closer ... I still got the 'Failed to call dspam' 
message, but dspam now seems to be called:



Nov  5 10:11:05 venus dspam[834]: DSPAM agent misconfigured: aborting

So now what happened to the arguments to dspam? Thanks very much for the 
help!
Ok, I got it, it works!  The primary solution was to comment out 
debugv() in dspam-exec.c ...


Then, as suggested I put back in the semicolon in my extra arguments to 
dspam and bingo!


:)

I just committed a fix to debugv(), can you try that? If you downloaded
the tarball, get this one:
http://git.sipsolutions.net/?p=dovecot-antispam.git;a=snapshot;h=HEAD;sf=tgz

If you can confirm that works I'll make a new release.

johannes


The fixed version works perfectly, thank you very much!

Rob K


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Johannes Berg
On Wed, 2008-11-05 at 10:44 -0500, Rob Klingsten wrote:
  On Wed, 2008-11-05 at 10:25 -0500, Rob Klingsten wrote:
  
  hmm. I wonder if there's a bug in debugv(), can you comment that call
  out in dspam-exec.c?
 
  johannes
  Aha, that's getting closer ... I still got the 'Failed to call dspam' 
  message, but dspam now seems to be called:
  
  Nov  5 10:11:05 venus dspam[834]: DSPAM agent misconfigured: aborting
 
  So now what happened to the arguments to dspam? Thanks very much for the 
  help!
  Ok, I got it, it works!  The primary solution was to comment out 
  debugv() in dspam-exec.c ...
 
  Then, as suggested I put back in the semicolon in my extra arguments to 
  dspam and bingo!
  
  :)
  
  I just committed a fix to debugv(), can you try that? If you downloaded
  the tarball, get this one:
  http://git.sipsolutions.net/?p=dovecot-antispam.git;a=snapshot;h=HEAD;sf=tgz
  
  If you can confirm that works I'll make a new release.
  
  johannes
 
 The fixed version works perfectly, thank you very much!

And it prints the full command line to the syslog, I assume? Thanks for
testing!

johannes


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


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Rob Klingsten

I just committed a fix to debugv(), can you try that? If you downloaded
the tarball, get this one:
http://git.sipsolutions.net/?p=dovecot-antispam.git;a=snapshot;h=HEAD;sf=tgz

If you can confirm that works I'll make a new release.

johannes

The fixed version works perfectly, thank you very much!


And it prints the full command line to the syslog, I assume? Thanks for
testing!

johannes


Yes, it's great!

Nov  5 10:50:10 venus imap: antispam: dspam binary set to 
/usr/local/bin/dspam

Nov  5 10:50:10 venus imap: antispam: dspam extra arg --user
Nov  5 10:50:10 venus imap: antispam: dspam extra arg [EMAIL PROTECTED]
Nov  5 10:50:10 venus imap: antispam: signature header line is 
X-DSPAM-Signature

Nov  5 10:50:13 venus imap: antispam: mailbox_is_unsure(INBOX): 0
Nov  5 10:50:13 venus imap: antispam: mailbox_is_trash(Spam): 0
Nov  5 10:50:13 venus imap: antispam: mailbox_is_trash(INBOX): 0
Nov  5 10:50:13 venus imap: antispam: mail copy: from trash: 0, to trash: 0
Nov  5 10:50:13 venus imap: antispam: mailbox_is_spam(Spam): 1
Nov  5 10:50:13 venus imap: antispam: mailbox_is_spam(INBOX): 0
Nov  5 10:50:13 venus imap: antispam: mailbox_is_unsure(Spam): 0
Nov  5 10:50:13 venus imap: antispam: mail copy: src spam: 1, dst spam: 
0, src unsure: 0
Nov  5 10:50:13 venus imap: antispam: /usr/local/bin/dspam 
--source=error --class=innocent --signature=4911bedc107624643064458 
--user [EMAIL PROTECTED]


Thanks!

Rob K


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Johannes Berg
On Wed, 2008-11-05 at 10:51 -0500, Rob Klingsten wrote:

 Yes, it's great!

 Nov  5 10:50:13 venus imap: antispam: /usr/local/bin/dspam 
 --source=error --class=innocent --signature=4911bedc107624643064458 
 --user [EMAIL PROTECTED]

Just wanted to make sure, thanks! I've pushed out a tag, tarball will be
generated automatically in a few hours, but obviously the contents will
be identical to the one you have.

johannes


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


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Eugene

Hi Johannes,


From: Johannes Berg [EMAIL PROTECTED]

 I just committed a fix to debugv(), can you try that? If you downloaded
 the tarball, get this one:
 http://git.sipsolutions.net/?p=dovecot-antispam.git;a=snapshot;h=HEAD;sf=tgz

 If you can confirm that works I'll make a new release.

The fixed version works perfectly, thank you very much!


And it prints the full command line to the syslog, I assume? Thanks for
testing!


It solves the problem here as well =)
Thanks for the update.

Do you plan to implement 'out of band' dspam calling?
BTW maybe there is no need for a separate 'queue' folder especially as we 
only need a message signature. I think it can be stored in some buffer array 
so as the dspam calls are made i.e. during idle time (or during final 
cleanup at the latest).


Also I am attaching a couple of patches that might be useful.
dspam-exec.c.patch adds debug-dumping of the dspam reply (it turned out 
quite useful not only for the stack corruption problem).
Makefile.patch fixes the syntax to compile with gmake under FreeBSD 6.1 and 
also adjusts the installed plugin permissions.


Best wishes
Eugene


patch-genie.tgz
Description: Binary data


Re: [Dovecot] Another dovecot-antispam plugin can't call dspam

2008-11-05 Thread Johannes Berg
Hi Eugene,

  And it prints the full command line to the syslog, I assume? Thanks for
  testing!
 
 It solves the problem here as well =)
 Thanks for the update.

Yeah, I thought so, somehow I just didn't have the idea to look at
debugv() when you mentioned the problem.

 Do you plan to implement 'out of band' dspam calling?
 BTW maybe there is no need for a separate 'queue' folder especially as we 
 only need a message signature. I think it can be stored in some buffer array 
 so as the dspam calls are made i.e. during idle time (or during final 
 cleanup at the latest).

Well, I tried doing that with the signature-log backend, but that seemed
somewhat problematic to me although somebody said it actually works for
him.

 Also I am attaching a couple of patches that might be useful.
 dspam-exec.c.patch adds debug-dumping of the dspam reply (it turned out 
 quite useful not only for the stack corruption problem).
 Makefile.patch fixes the syntax to compile with gmake under FreeBSD 6.1 and 
 also adjusts the installed plugin permissions.

Thanks, I've added the Makefile patch, but the other one I'm not too
sure about, it seems it would print things twice if the loop actually
looped, so I left it for now. Also, your code can access
buf[sizeof(buf)] which would be a buffer overrun.

johannes


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