You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/09/08 07:11:09 UTC

svn commit: r279517 - in /spamassassin/branches/3.1: rules/20_uri_tests.cf t/uri.t

Author: jm
Date: Wed Sep  7 22:11:06 2005
New Revision: 279517

URL: http://svn.apache.org/viewcvs?rev=279517&view=rev
Log:
bug 4572: catch redirections using EmailFactory (emf0.com)

Modified:
    spamassassin/branches/3.1/rules/20_uri_tests.cf
    spamassassin/branches/3.1/t/uri.t

Modified: spamassassin/branches/3.1/rules/20_uri_tests.cf
URL: http://svn.apache.org/viewcvs/spamassassin/branches/3.1/rules/20_uri_tests.cf?rev=279517&r1=279516&r2=279517&view=diff
==============================================================================
--- spamassassin/branches/3.1/rules/20_uri_tests.cf (original)
+++ spamassassin/branches/3.1/rules/20_uri_tests.cf Wed Sep  7 22:11:06 2005
@@ -31,6 +31,7 @@
 redirector_pattern	/^http:\/\/redir\.internet\.com\/.+?\/.+?\/(.*)$/i
 redirector_pattern	/^http:\/\/(?:.*?\.)?adtech\.de\/.*(?:;|\|)link=(.*?)(?:;|$)/i
 redirector_pattern	m'^http.*?/redirect\.php\?.*(?<=[?&])goto=(.*?)(?:$|[&\#])'i
+redirector_pattern      m'^https?:/*(?:[^/]+\.)?emf\d\.com/r\.cfm.*?&r=(.*)'i
 
 uri NUMERIC_HTTP_ADDR		/^https?\:\/\/\d{7}/is
 describe NUMERIC_HTTP_ADDR	Uses a numeric IP address in URL

Modified: spamassassin/branches/3.1/t/uri.t
URL: http://svn.apache.org/viewcvs/spamassassin/branches/3.1/t/uri.t?rev=279517&r1=279516&r2=279517&view=diff
==============================================================================
--- spamassassin/branches/3.1/t/uri.t (original)
+++ spamassassin/branches/3.1/t/uri.t Wed Sep  7 22:11:06 2005
@@ -17,12 +17,13 @@
 
 use strict;
 use Test;
-use SATest;
+use SATest; sa_t_init("uri");
+
 use Mail::SpamAssassin;
 use Mail::SpamAssassin::HTML;
 use Mail::SpamAssassin::Util;
 
-plan tests => 80;
+plan tests => 82;
 
 ##############################################
 
@@ -107,9 +108,7 @@
 
 sub try_canon {
   my($input, $expect) = @_;
-  my $redirs = ['/^(?:http://)?chkpt\.zdnet\.com/chkpt/\w+/(.*)$/',
-                '/^(?:http://)?www\.nate\.com/r/\w+/(.*)$/',
-               ];
+  my $redirs = $sa->{conf}->{redirector_patterns};
   my @input = sort { $a cmp $b } Mail::SpamAssassin::Util::uri_list_canonify($redirs, @{$input});
   my @expect = sort { $a cmp $b } @{$expect};
 
@@ -152,6 +151,21 @@
    'http://www.google.com/url?q=http://www.google.com/url?q=http://www.expage.com/manger32',
    ]));
 
+# redirector_pattern test
+ok(try_canon(['http://chkpt.zdnet.com/chkpt/baz/jmason.org'],
+   [
+   'http://chkpt.zdnet.com/chkpt/baz/jmason.org',
+   'http://jmason.org',
+   'jmason.org',
+   ]));
+
+ok(try_canon(['http://emf0.com/r.cfm?foo=bar&r=jmason.org'],
+   [
+   'http://emf0.com/r.cfm?foo=bar&r=jmason.org',
+   'http://jmason.org',
+   'jmason.org',
+   ]));
+
 ok(try_canon(["ht\rtp\r://www.kl\nuge.n\net/"],
   ['http://www.kluge.net/']
   ));
@@ -173,6 +187,8 @@
    ], [
    'http://www.nate.com/r/DM03/n%65verp4%79re%74%61%69%6c%2eco%6d/%62%61m/?m%61%6e=%6Di%634%39',
    'http://www.nate.com/r/DM03/neverp4yretail.com/bam/?man=mic49',
+   'http://neverp4yretail.com/bam/?man=mic49',
+   'neverp4yretail.com/bam/?man=mic49',
    ]));
 
 ##############################################