From: Mark M. <Mar...@ij...> - 2009-02-27 21:09:58
|
Danny, > I'd like to block outgoing Word-Documents. > > So I take the MYNET policy_bank like this: > > $policy_bank{'MYNETS'} = { # mail originating from @mynetworks > banned_namepath_re => [ > new_RE( > qr'(?#BLOCK WORD OUTGOING) ^(.*\t)? T=doc (\t.*)? $'xm, > ), > ], > }; > But amavis stop processing with this error: > > Feb 26 08:48:50 pluto amavis[17879]: (17879-01) (!!)TROUBLE in > check_mail: check-banned FAILED: Not a SCALAR reference at > /usr/sbin/amavisd line 6105. Two mistakes here, one is yours, one is mine. As the $banned_namepath_re is a scalar and not an array, the [ ... ] brackets around new_RE() are wrong, it should be: $policy_bank{'MYNETS'} = { banned_namepath_re => new_RE( qr'(?#BLOCK WORD OUTGOING) ^(.*\t)? T=doc (\t.*)? $'xm, ), }; The other thing wrong is a bug, please try the following patch: --- amavisd.orig 2008-12-15 01:50:09.000000000 +0100 +++ amavisd 2009-02-27 22:05:32.000000000 +0100 @@ -6936,7 +6936,8 @@ } my($bnpre) = cr('banned_namepath_re'); + $bnpre = $$bnpre if ref($bnpre) eq 'REF'; # allow one level of indirection if (!$any_not_bypassed) { do_log(3,"skipping banned check: all recipients bypass banned checks"); - } elsif (!$any_table_in_recip_tables && !(ref $bnpre && ref $$bnpre)) { + } elsif (!$any_table_in_recip_tables && !ref($bnpre)) { do_log(3,"skipping banned check: no applicable lookup tables"); } else { @@ -7015,6 +7016,5 @@ } } - if (ref $bnpre && ref $$bnpre && - grep {!$_->{result}} @recip_tables) { # any non-true remains + if (ref $bnpre && grep {!$_->{result}} @recip_tables) { # any non-true? # try new style: banned_namepath_re; it is global, not per-recipient my($result,$matchingkey) = lookup2(0, join("\n",@descr), [$bnpre], Mark |