Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-22 Thread Mikael Jenkler

if it does not exist get_mail_headers returns null or something ?

is this not the best way?
resiptient  = get_mail_headers(mail, "Delivered-To");

is mail a global var ?

Regards
/J3nkl3r


Johannes Berg wrote:

On Fri, 2008-08-22 at 11:35 +0200, Mikael Jenkler wrote:
  

I dont have the old orginal code anymore :-( only have the modded one

I can try to patch it myself, can you tell me where in what variable you 
have the mail header or mail

Is it reachable in  dspam-exec.c



Just took a quick look, you seem to be using the "Delivered-To" header.
That's not guaranteed to be present in any way.

  

I relly want this to work :-)



hack it into the current code, it's possible, or just use the mailtrain
backend to mail it to the dspam learning process.

johannes
  




Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-22 Thread Mikael Jenkler

I dont have the old orginal code anymore :-( only have the modded one

I can try to patch it myself, can you tell me where in what variable you 
have the mail header or mail

Is it reachable in  dspam-exec.c

I relly want this to work :-)

Regards
/Jenkler

Johannes Berg wrote:

On Fri, 2008-08-22 at 11:21 +0200, Mikael Jenkler wrote:
  
What do you think about the modified plugin, can it be done in the new 
version? what var contains the mail or header?



I haven't even looked at it, since I don't know that old code any more.
If you can send me a diff, then I can maybe take a look.

johannes
  




Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-22 Thread Mikael Jenkler
What do you think about the modified plugin, can it be done in the new 
version? what var contains the mail or header?


Regards
/j3nkl3r

Mikael Jenkler wrote:
The problem is that i dont have it working for the new antispam but 
here is your old script with the recipient fixed
This is 100% your code so you should be able to understand what i have 
done


You have changed 1000 things in your antispam plugin so it relly hard 
for me to patch it
atleast take a look at it, if its possible to do the same thing with 
the new plugin, please


I think that more people then me would like this feature, if the to is 
wrong  then  its wrong  but it would be great if this feature  
existed  = me happy ;-)


Look att the attached lib_dspam.c
/J3nkl3r

Johannes Berg wrote:

On Thu, 2008-08-21 at 16:15 +0200, Mikael Jenkler wrote:
 
The problem is that my %u is a user not the mail address and i train 
on the mail address from master.cf
I modded your old script to support (for dovecot 1.0.x) it but when 
1.1.x came it didnot work anymore


i have a diffrent username for auth then for resiveing  mail  so  it 
impossible to  train on that

You could have a option called train on resiptient or something

i got the recipient address in the script then added this:

execl(DSPAM, "--source=error", "--stdout", "--user", recipient, 
class_arg, sign_arg, NULL);



So how did you get the recipient? What if the To: header isn't right?
Did you use the envelope recipient? How did you get it?

I'd rather not open that can of worms. If you can send me a clean patch,
I might integrate it, but I'm surely not going to work on it.

johannes
  






Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-21 Thread Mikael Jenkler
The problem is that i dont have it working for the new antispam but here 
is your old script with the recipient fixed

This is 100% your code so you should be able to understand what i have done

You have changed 1000 things in your antispam plugin so it relly hard 
for me to patch it
atleast take a look at it, if its possible to do the same thing with the 
new plugin, please


I think that more people then me would like this feature, if the to is 
wrong  then  its wrong  but it would be great if this feature  existed  
= me happy ;-)


Look att the attached lib_dspam.c
/J3nkl3r 



Johannes Berg wrote:

On Thu, 2008-08-21 at 16:15 +0200, Mikael Jenkler wrote:
  
The problem is that my %u is a user not the mail address and i train on 
the mail address from master.cf
I modded your old script to support (for dovecot 1.0.x) it but when 
1.1.x came it didnot work anymore


i have a diffrent username for auth then for resiveing  mail  so  it 
impossible to  train on that

You could have a option called train on resiptient or something

i got the recipient address in the script then added this:

execl(DSPAM, "--source=error", "--stdout", "--user", recipient, 
class_arg, sign_arg, NULL);



So how did you get the recipient? What if the To: header isn't right?
Did you use the envelope recipient? How did you get it?

I'd rather not open that can of worms. If you can send me a clean patch,
I might integrate it, but I'm surely not going to work on it.

johannes
  


/*
  To use this plugin, you need to configure dspam to
* deliver spam into the SPAM folder for each user
* add a X-DSPAM-Signature header line with the signature. Body or
  attachment signatures do not work, as dovecot is programmed to
  extract the signature. It should be trivial to change this,
  but it seemed cleaner this way. If you want (or already have)
  a different header line name, then just change
  the #define on top of the file.

  To compile:
  make "plugins" directory right beside "src" in the dovecot source tree,
  copy this into there and run

  cc -fPIC -shared -Wall -I../src/ -I../src/lib -I.. -I../src/lib-storage \
  -I../src/lib-mail -I../src/lib-imap -I../src/imap/ -DHAVE_CONFIG_H \
  lib_dspam.c -o lib30_dspam.so

  Add -DDEBUG_DSPAM for debug

  Install the plugin in the usual dovecot module location.
  copy the plugin to /usr/lib/dovecot/imap folder

  If you need to ignore a trash folder, define a trash folder
  name as follows, or alternatively give -DIGNORE_TRASH_NAME=\"Trash\" on
  the cc command line.
*/

#include "common.h"
#include "str.h"
#include "strfuncs.h"
#include "commands.h"
#include "imap-search.h"
#include "lib-storage/mail-storage.h"
#include "lib/mempool.h"
#include "mail-storage.h"
#include 
#include 
#include 
#include 
#include 
#include 
#ifdef DEBUG_DSPAM
#include 
#endif

#define IGNORE_TRASH_NAME "INBOX.Trash"
#define MAXSIGLEN 100
#define RECIPIENT "Delivered-To"
#define SIGHEADERLINE "X-DSPAM-Signature"

#ifndef DSPAM
#define DSPAM "/usr/bin/dspam"
#endif /* DSPAM */

static int
call_dspam(const char* signature, int is_spam, const char* recipient)
{
pid_t pid;
int s;
char class_arg[16+2];
char sign_arg[MAXSIGLEN+2];
int pipes[2];

s = snprintf(sign_arg, 101, "--signature=%s", signature);
if ( s > MAXSIGLEN || s <= 0) return -1;

snprintf(class_arg, 17, "--class=%s", is_spam ? "spam" : "innocent");

pipe(pipes); /* for dspam stderr */

pid = fork();
if (pid < 0) return -1;

if (pid) {
int status;
/* well. dspam doesn't report an error if it has an error,
   but instead only prints stuff to stderr. Usually, it
   won't print anything, so we treat it having output as
   an error condition */

char buf[1024];
int readsize;
close(pipes[1]);

do {
readsize = read(pipes[0], buf, 1024);
if (readsize < 0) {
readsize = -1;
if (errno == EINTR) readsize = -2;
}
} while (readsize == -2);

if (readsize != 0) {
close(pipes[0]);
return -1;
}

waitpid (pid, &status, 0);
if (!WIFEXITED(status)) {
close(pipes[0]);
return -1;
}

readsize = read(pipes[0], buf, 1024);
if (readsize != 0) {
close(pipes[0]);
return -1;
}

close(pipes[0]);
return WEXITSTATUS(status);
} else {
int fd = open("/dev/null", O_RDONLY);
close(0); close(1); close(2);
/* see above */
close(pipes[0]);

if (dup2(pipes[1], 2) != 2) {
exit(1);
}
if

Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-21 Thread Mikael Jenkler
The problem is that my %u is a user not the mail address and i train on 
the mail address from master.cf
I modded your old script to support (for dovecot 1.0.x) it but when 
1.1.x came it didnot work anymore


i have a diffrent username for auth then for resiveing  mail  so  it 
impossible to  train on that

You could have a option called train on resiptient or something

i got the recipient address in the script then added this:

execl(DSPAM, "--source=error", "--stdout", "--user", recipient, 
class_arg, sign_arg, NULL);



Regards
/J3nkl3r

Johannes Berg wrote:
My dspam users has the email as username [EMAIL PROTECTED] and in 
dovecot.conf i need to specify the user when training, is there a
way to get the resiptient address in the dovecot.conf? i am only able to 
get %u ie the username ;-(


Could you patch the antispam plugin to be able to take then resiptient 
as dspam user? ie  the mail address , you can have a option in dovecot 
that says use resiptient address as user or something


it would be great if you had time to check this out ;-)



TBH, I don't, and I also don't see why you'd need the recipient address,
can't you just build it like [EMAIL PROTECTED] or [EMAIL PROTECTED] or 
something?

johannes
  




Re: [Dovecot] dovecot-antispam has some kind of bug

2008-08-21 Thread Mikael Jenkler
Needed to be a member, now its done, sorry for remailing this again 
(need to be in list)


Mikael Jenkler wrote:

Yeah!

My problem is gone. needed:
latest dovecot-antispam plugin
and dovecot-1.1.2 minimum

Thanks Johannes


about my other  question:


My dspam users has the email as username [EMAIL PROTECTED] and in 
dovecot.conf i need to specify the user when training, is there a
way to get the resiptient address in the dovecot.conf? i am only able 
to get %u ie the username ;-(


Could you patch the antispam plugin to be able to take then resiptient 
as dspam user? ie  the mail address , you can have a option in dovecot 
that says use resiptient address as user or something


it would be great if you had time to check this out ;-)






/J3nkl3r


On Mon, 2008-08-18 at 10:04 +0200, Mikael Jenkler wrote:


> Hi All!
> > There is a issue with dovecot-antispam and the new dovecot-1.1.x 
> (dovecot-1.1.1)
  


The antispam plugin requires 1.1.2

johannes





Johannes Berg wrote:

On Thu, 2008-08-21 at 12:25 +0200, Mikael Jenkler wrote:
 

Hi Johannes!

it seams that you pluggin is doing something wrong with the imap 
connection


i get this:

Aug 21 12:21:54 firestorm dovecot: child 21443 (imap) killed with 
signal 11


both with squirrelmail and mutt mail clients, but only when the 
pluggin is enabled in dovecot

iam using dovecot-1.1.1

have you seen this error before?



Only with older versions of my plugin. Are you using the latests dovecot
1.1 and my plugin? We'll need you to compile both dovecot and the plugin
with debugging information and provide a backtrace.

johannes
  







Re: [Dovecot] dovecot-antispam: Failed to read mail beginning, Next message unexpectedly lost

2008-08-20 Thread Mikael Jenkler

Jiri Novosad wrote:



Mikael Jenkler wrote:

I have some issues to with dovecot 1.1.x, it seams buggish
do you also have this issue?





There is a issue with dovecot-antispam and the new dovecot-1.1.x 
(dovecot-1.1.1)
The imap server dies when sending mail, the mail goes away but it 
says that the imap server has crached in squirrelmail.


I get the standard signal 11 crach in the dovecot loggs


I don't use squirrelmail.
Ok but it seams that the antispam plugin is unstable, the error only 
exist when loading the plugin.




another question?

My dspam users has the email as username somthing at domain.com 
<http://dovecot.org/cgi-bin/mailman/listinfo/dovecot> and in 
dovecot.conf i need to specify the user when training, is there a w
way to get the resiptient address in the dovecot.conf? i am only able 
to get %u ie the username ;-(


You could use the mailtrain (antispam_mail_sendmail) backend and using
a custom script somehow look up the correct sender from the username.
Then hand the mail off to dspam.

J. N.
I relly don't want to use mailtrain because i call dspam from postfix 
master.cf, i don't want extra scripts
The best solution for now is training all mail for 1 user (a static 
username) its relly crapy that dovecot is not able to parse the mail 
header for the reciptent address




Could you patch the antispam plugin to be able to take then 
resiptient as dspam user? ie  the mail address , you can have a 
option in dovecot that says use resiptient address as user or something


it would be great if you had time to check this out ;-)

Thanks in advance





Re: [Dovecot] dovecot-antispam: Failed to read mail beginning, Next message unexpectedly lost

2008-08-20 Thread Mikael Jenkler

I have some issues to with dovecot 1.1.x, it seams buggish
do you also have this issue?





There is a issue with dovecot-antispam and the new dovecot-1.1.x 
(dovecot-1.1.1)
The imap server dies when sending mail, the mail goes away but it says 
that the imap server has crached in squirrelmail.


I get the standard signal 11 crach in the dovecot loggs

another question?

My dspam users has the email as username somthing at domain.com  and in 
dovecot.conf i need to specify the user when training, is there a w
way to get the resiptient address in the dovecot.conf? i am only able to 
get %u ie the username ;-(


Could you patch the antispam plugin to be able to take then resiptient 
as dspam user? ie  the mail address , you can have a option in dovecot 
that says use resiptient address as user or something


it would be great if you had time to check this out ;-)

Thanks in advance

--







Jiri Novosad wrote:

Hi again,

I tried this on Gentoo with dovecot-antispam version 20080601 and
dovecot versions 1.0.15-r1, 1.1.0, 1.1.1 and 1.1.2.
Versions 1.1.0+ all fail.
Version 1.0.15-r1 works fine, even if I add the "Next message
unexpectedly lost" check (see below).

So it seems to be a bug in dovecot (? but I guess it could be
dovecot-antispam, too).

Could someone at least confirm this behaviour?
Note that I use mbox, maildir seems to be OK.

Jiri Novosad

Jiri Novosad wrote:

Hello,

I'm trying to configure the dovecot-antispam plugin.
Now I've run into a problem: whenever I try to move/copy a message
in/from the spam mailbox, Thunderbird (and also Sylpheed, haven't tried
anything else) says:

The current command did not succeed. The mail server responded: Failed
to read mail beginning.

and in the logs I get:

dovecot: Aug 07 10:41:23 Error: IMAP(username): Next message
unexpectedly lost from 337928
dovecot: Aug 07 10:41:23 Error: IMAP(username): Next message
unexpectedly lost from 337928

The message is not moved/copied.

My config (dovecot -n):

base_dir: /var/run/dovecot_test/
log_path: /var/log/dovecot/test_log
info_log_path: /var/log/dovecot/test_info_log
protocols: pop3s imaps pop3 imap
listen(default): *:10143
listen(imap): *:10143
listen(pop3): *:10110
ssl_listen(default): *:10993
ssl_listen(imap): *:10993
ssl_listen(pop3): *:10995
ssl_cert_file: /etc/ssl/anxur.pem
ssl_key_file: /etc/ssl/anxur.pem
ssl_parameters_regenerate: 24
login_dir: /var/run/dovecot_test/login
login_executable(default):
/packages/run.64/dovecot-1.1.2/libexec/dovecot/imap-login
login_executable(imap):
/packages/run.64/dovecot-1.1.2/libexec/dovecot/imap-login
login_executable(pop3):
/packages/run.64/dovecot-1.1.2/libexec/dovecot/pop3-login
login_greeting: HI!
login_greeting_capability(default): yes
login_greeting_capability(imap): yes
login_greeting_capability(pop3): no
verbose_proctitle: yes
first_valid_uid: 200
mail_location:
mbox:/home/%u/mail/:INBOX=/var/mail/%u:INDEX=/home/%u/mail/.imap
mail_debug: yes
mail_full_filesystem_access: yes
maildir_copy_with_hardlinks: no
mbox_write_locks: fcntl
mbox_dirty_syncs: no
mbox_lazy_writes: no
dbox_rotate_days: 0
mail_executable(default):
/packages/run.64/dovecot-1.1.2/libexec/dovecot/imap
mail_executable(imap): 
/packages/run.64/dovecot-1.1.2/libexec/dovecot/imap
mail_executable(pop3): 
/packages/run.64/dovecot-1.1.2/libexec/dovecot/pop3

mail_plugins(default): antispam
mail_plugins(imap): antispam
mail_plugins(pop3):
mail_plugin_dir(default): 
/packages/run.64/dovecot-1.1.2/lib/dovecot/imap

mail_plugin_dir(imap): /packages/run.64/dovecot-1.1.2/lib/dovecot/imap
mail_plugin_dir(pop3): /packages/run.64/dovecot-1.1.2//lib/dovecot/pop3
mail_log_max_lines_per_sec: 20
imap_max_line_length(default): 131072
imap_max_line_length(imap): 131072
imap_max_line_length(pop3): 65536
imap_client_workarounds(default): delay-newmail outlook-idle
tb-extra-mailbox-sep
imap_client_workarounds(imap): delay-newmail outlook-idle
tb-extra-mailbox-sep
imap_client_workarounds(pop3):
pop3_uidl_format(default): %08Xu%08Xv
pop3_uidl_format(imap): %08Xu%08Xv
pop3_uidl_format(pop3): %08Xv%08Xu
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
 mechanisms: gssapi plain
 executable: 
/packages/run.64/dovecot-1.1.2/libexec/dovecot/dovecot-auth

 krb5_keytab: /etc/krb5.imap
 verbose: yes
 debug: yes
 passdb:
   driver: pam
   args: dovecot
 userdb:
   driver: passwd
plugin:
 antispam_spam: mailbox.spam
 antispam_trash: trash;Trash;Deleted Items
 antispam_mail_spam: [EMAIL PROTECTED]
 antispam_mail_notspam: [EMAIL PROTECTED]
 antispam_mail_sendmail: /home/username/fake_sendmail

Dovecot is version 1.1.2, dovecot-antispam is the latest snapshot.
Running on Red Hat Enterprise Linux Server release 5.2, 

[Dovecot] Regarding dovecot-antispam bug!

2008-08-18 Thread Mikael Jenkler

Hi All!

There is a issue with dovecot-antispam and the new dovecot-1.1.x 
(dovecot-1.1.1)
The imap server dies when sending mail, the mail goes away but it says 
that the imap server has crached in squirrelmail.


I get the standard signal 11 crach in the dovecot loggs

another question?

My dspam users has the email as username [EMAIL PROTECTED] and in 
dovecot.conf i need to specify the user when training, is there a w
way to get the resiptient address in the dovecot.conf? i am only able to 
get %u ie the username ;-(


Could you patch the antispam plugin to be able to take then resiptient 
as dspam user? ie  the mail address , you can have a option in dovecot 
that says use resiptient address as user or something


it would be great if you had time to check this out ;-)

Thanks in advance