Bug 1091 - find_all_addrs_in_line hostname matching rules
Summary: find_all_addrs_in_line hostname matching rules
Status: CLOSED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamassassin (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: All All
: P5 trivial
Target Milestone: ---
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-10 08:49 UTC by Klaus Johannes Rusch
Modified: 2002-12-20 00:08 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Johannes Rusch 2002-10-10 08:49:42 UTC
find_all_addrs_in_line unnecessarily allows a dot in the first hostname 
component, resulting in backtracking since first all dotted components are 
matched, then the mandatory dot \. is not matched.

Suggested modification:
  my $ID_PATTERN   = '[-a-z0-9_\+\:\/\.]+';
  my $HOST_PATTERN = '[-a-z0-9_\+\:\/]+';

  while ($line =~ s/(?:mailto:)?\s*
    ($ID_PATTERN
	\@
	$HOST_PATTERN(?:\.$HOST_PATTERN)+)//oix) 
  {
    my $addr = $1;
    next if (defined ($seen{$addr})); $seen{$addr} = 1;
    push (@addrs, $addr);
  }
Comment 1 Justin Mason 2002-12-20 08:53:57 UTC
Thanks Klaus, makes sense. now in....
Comment 2 Klaus Johannes Rusch 2002-12-20 09:08:41 UTC
Justin, thanks for accepting this change.