I really dislike these kinds of "band-aids" which really don't help the main
cause: terribly convoluted plugin code.  Why skip debug output if owner is
missing?  Is the a good reason for owner missing, what is the cause for that
and can it be better fixed upstream?  Why are there all kinds of regexs
without any sanity/error checks?  Etc..

If I don't hear any volunteers, I guess I need to try to clean up this too.


On Tue, May 03, 2022 at 02:56:35PM -0000, gbec...@apache.org wrote:
> Author: gbechis
> Date: Tue May  3 14:56:35 2022
> New Revision: 1900514
> 
> URL: http://svn.apache.org/viewvc?rev=1900514&view=rev
> Log:
> silence a warning if uri_to_domain fails.
> bz #7984
> 
> Modified:
>     spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm
> 
> Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm
> URL: 
> http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm?rev=1900514&r1=1900513&r2=1900514&view=diff
> ==============================================================================
> --- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm 
> (original)
> +++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/FromNameSpoof.pm Tue May  
> 3 14:56:35 2022
> @@ -390,9 +390,9 @@ sub _check_fromnamespoof
>      $pms->set_tag("FNSFNAMEDOMAIN", $fnd{'domain'});
>      $pms->set_tag("FNSFADDRDOMAIN", $fad{'domain'});
>  
> -    dbg("From name spoof: $fnd{addr} $fnd{domain} $fnd{owner}");
> -    dbg("Actual From: $fad{addr} $fad{domain} $fad{owner}");
> -    dbg("To Address: $tod{addr} $tod{domain} $tod{owner}");
> +    dbg("From name spoof: $fnd{addr} $fnd{domain} $fnd{owner}") if defined 
> $fnd{owner};
> +    dbg("Actual From: $fad{addr} $fad{domain} $fad{owner}") if defined 
> $fad{owner};
> +    dbg("To Address: $tod{addr} $tod{domain} $tod{owner}") if defined 
> $tod{owner};
>    }
>  }
>  
> @@ -410,6 +410,8 @@ sub _find_address_owner
>  
>    my $owner = $self->{main}->{registryboundaries}->uri_to_domain($check);
>  
> +  return if not defined $owner;
> +
>    $check =~ /^([^\@]+)\@(.*)$/;
>  
>    if ($owner ne $2) {
> 

Reply via email to