SQL per-user config: access sender info in $sql_select_policy
William Wilhelm via amavis-users
amavis-users at amavis.org
Sun May 25 10:32:01 CEST 2014
In case anyone else wants to accomplish the same, here's my solution. It
involves editing /usr/sbin/amavisd, or your equivalent, modifying the
$uname assignment to pass $msginfo->sender to lookup2 and then duplicating
the original line as the next and adding an extra conditional.
$ sed -n '27524,27529 p' /usr/sbin/amavisd
my($uconf,$uname);
my $recip_addr = $r->recip_addr;
$uconf = lookup2(0, $recip_addr, $uconf_maps_ref) if @$uconf_maps_ref;
$uname = lookup2(0, $msginfo->sender, $uname_maps_ref) if
@$uname_maps_ref;
$uname = lookup2(0, $recip_addr, $uname_maps_ref) if
@$uname_maps_ref && (!defined $uname || $uname eq '');
$uconf = '' if !defined $uconf;
Line numbers may be off in your version, but $uname = lookup2 should be
unique and therefore easy to locate.
On 18 May 2014 7:42:41 pm William Wilhelm via amavis-users
<amavis-users at amavis.org> wrote:
> Hi,
>
> I've got per-recipient config working well but since amavis is also
> scanning outgoing mail, I think it would make sense to have "per-sender"
> config as well, in the case where the sender is local.
>
> Is there some way to configure this? Really I think I only need the ability
> to refer to the sender in the $sql_select_policy query. Similarly to the %k
> placeholder which contains all things recipient. A skim of the code gave a
> glimmer of hope for %s, but that's not it.
>
> Thanks,
> Will
>
>
More information about the amavis-users
mailing list