[pmg-devel] [PATCH pmg-api] fix #2232: set rulename for default accept

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 5 19:34:36 CEST 2019


On 6/5/19 7:07 PM, Stoiko Ivanov wrote:
> Logging the rulename along with the action taken introduced in
> 365d5b9549d25a910c82cd37034f05e1c906565a, introduced a regression, for the
> default action (accept), since the accept-rule is instantiated directly it
> did not set a name, resulting in an 'Use of uninitialized value' being written
> to the mail.log for every mail not triggering any explicit rule.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> Testing every configurable Action-Object made me forget about the default case.
> Sorry!
> 
>  bin/pmg-smtp-filter | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bin/pmg-smtp-filter b/bin/pmg-smtp-filter
> index 31fddd5..d198239 100755
> --- a/bin/pmg-smtp-filter
> +++ b/bin/pmg-smtp-filter
> @@ -353,7 +353,7 @@ sub apply_rules {
>      if ($unmatched) {
>  	my $accept = PMG::RuleDB::Accept->new ();
>  	$accept->execute ($queue, $self->{ruledb}, $mod_group, $unmatched,
> -			  $msginfo, undef, undef, undef);
> +			  $msginfo, { RULE => 'default-accept' }, undef);
>      }
>  
>      return $matching_rules;
> 

could it make sense to instead do:

my $rulename = $vars->{RULE} // 'default-accept';

if we know that if nothing's here it's the default rule?

Or, else another sane default ('unknown'?) to avoid repetition of this issue?



More information about the pmg-devel mailing list