policy_bank reports unknown field

Mark Martinec Mark.Martinec+amavis at ijs.si
Sat Mar 17 01:12:33 CET 2012


Christian,

> I'm struggling a bit with this policy_bank definition:
> 
> $policy_bank{'SUBMIT'} = {
>   originating => 1,
>   virus_admin_maps => ["itadmin\@$mydomain"],
>   spam_admin_maps => ["itadmin\@$mydomain"],
>   spam_kill_level_maps => [7.5],
>   #spam_dsn_cutoff_level_maps => [15],
>   $final_virus_destiny  => D_BOUNCE,
>   $final_banned_destiny => D_BOUNCE,
>   $final_spam_destiny   => D_BOUNCE,
> };
> 
> It works fine, but whenever it is actually invoked, amavis complains
> about an "unknown field":
> 
> amavis[5159]: () (!)loading policy bank "SUBMIT": unknown field "-3"
> 
> Which field does it mean?

Leave out a dollar prefix in key names. A policy bank is an
associative array (a hash). Its elements are key/value pairs.
Each key is a name of a variable, but without its $ or @ or % prefix.

What happened in your case is the $final_virus_destiny was
first evaluated to its current value (D_REJECT is -3), then
the result was used as a key - and the '-3' is not a known
name of a setting.

Use this instead:

 $policy_bank{'SUBMIT'} = {
   originating => 1,
   virus_admin_maps => ["itadmin\@$mydomain"],
   spam_admin_maps => ["itadmin\@$mydomain"],
   spam_kill_level_maps => [7.5],
   final_virus_destiny  => D_BOUNCE,
   final_banned_destiny => D_BOUNCE,
   final_spam_destiny   => D_BOUNCE,
 };


Mark


More information about the amavis-users mailing list