From: Sébastien A. <sav...@al...> - 2010-09-28 07:44:31
|
Hi, We tried something like that with a custom conf hook, but it's seems that destiny cannot be set, we also tried the same code in different hook (befor_send, mail_done, new) and nothing works. We want to know where final_spam_destiny is used and how can we set it. sub checks { my($self,$conn,$msginfo) = @_; do_log(1,"========================= CUSTOM: entered checks hook"); my($spam_level) = $msginfo->spam_level; my($spam_status) = $msginfo->spam_status; my ($socket_port) = $conn->socket_port; my($conn_h) = $self->{'conn_h'}; $conn_h->begin_work_nontransaction; # (re)connect if not connected my($select_clause) = 'SELECT final_spam_destiny FROM policy WHERE policy_name=?'; my($per_recip_data) = $msginfo->per_recip_data; if (@$per_recip_data) { do_log(1,"========================= CUSTOM: per_recip_data=%s",@$per_recip_data); for my $r (@$per_recip_data) { my($recip) = $r->recip_addr; # recipient envelope address, e.g. rc...@ex... do_log(1,"========================= CUSTOM: recips=%s: destiny:%s",$r->recip_addr, $r->recip_destiny ); my($localpart,$domain) = split_address($recip); local($1,$2); $domain = $1 if $domain =~ /^\@?(.*?)\.*\z/s; # chop leading @ and tr. dots # list of actual arguments replacing '?' placeholders my(@pos_args) = ( lc(untaint($domain)) ); do_log(1,"========================= CUSTOM: execute SQLquery=%s. ARGS=%s", $select_clause,@pos_args); $conn_h->execute($select_clause,@pos_args); # do the query my($a_ref); my($final_destiny); while ( defined($a_ref=$conn_h->fetchrow_arrayref($select_clause)) ) { do_log(1,"========================= CUSTOM: a_ref=%s",$a_ref->[0] ); $final_destiny = D_PASS if $a_ref->[0] =~ /^D_PASS$/i; $final_destiny = D_DISCARD if $a_ref->[0] =~ /^D_DISCARD$/i; $final_destiny = D_BOUNCE if $a_ref->[0] =~ /^D_BOUNCE$/i; do_log(1,"========================= CUSTOM: final_destiny=%d",$final_destiny ); $r->recip_destiny ( $final_destiny ); } $conn_h->finish($select_clause) if defined $a_ref; # only if not all read } } $self; } Sébastien AVELINE sav...@al... <mailto:sav...@al...> Service Exploitation Alinto // email and more 15 quai Tilsitt - 69002 Lyon (France) Tel. : +33(0)4 78 38 73 62 - Fax : +33(0)4 26 68 91 68 Site web : www.alinto.com <http://www.alinto.com> Blog : www.demainlemail.com <http://www.demainlemail.com> Suivez Alinto sur Twitter <http://twitter.com/alinto_news> & Facebook <http://www.facebook.com/group.php?v=wall&gid=314333826838> Le 27/09/2010 11:35, Sébastien AVELINE a écrit : > Hello, > > I would like to have different final_spam_destiny by using sql lookup > (we try to setup a spam_destiny per user policy) > Actually, I've tried to add a final_spam_destiny column in my policy > table and it doesn't work, and I like to know if I had to change amavisd > code or if there is a trick to do that. Do I need to use spam_lovers > column in order to achieve that. > > Thank you. > > Sebastien AVELINE. > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > AMaViS-user mailing list > AMa...@li... > https://lists.sourceforge.net/lists/listinfo/amavis-user > Please visit http://www.ijs.si/software/amavisd/ regularly > For administrativa requests please send email to rainer at openantivirus dot org > |