amavis-user March 2012 archive
Main Archive Page > Month Archives  > amavis-user archives
amavis-user: Re: policy_bank reports unknown field

Re: policy_bank reports unknown field

From: Mark Martinec <Mark.Martinec+amavis_at_nospam>
Date: Sat Mar 17 2012 - 00:12:33 GMT
To: amavis-users@amavis.org

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