View | Details | Raw Unified | Return to bug 150764
Collapse All | Expand All

(-)Makefile (-8 / +12 lines)
Lines 17-35 Link Here
17
COMMENT=	A highly efficient mail filter for identifying spam
17
COMMENT=	A highly efficient mail filter for identifying spam
18
18
19
BUILD_DEPENDS=	p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
19
BUILD_DEPENDS=	p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
20
		p5-Archive-Tar>=1.23:${PORTSDIR}/archivers/p5-Archive-Tar \
21
		p5-Net-DNS>=0.63:${PORTSDIR}/dns/p5-Net-DNS \
20
		p5-Net-DNS>=0.63:${PORTSDIR}/dns/p5-Net-DNS \
22
		p5-Compress-Zlib>=2.04:${PORTSDIR}/archivers/p5-Compress-Zlib \
23
		p5-IO-Zlib>=1.04:${PORTSDIR}/archivers/p5-IO-Zlib \
24
		p5-HTML-Parser>=3.43:${PORTSDIR}/www/p5-HTML-Parser \
21
		p5-HTML-Parser>=3.43:${PORTSDIR}/www/p5-HTML-Parser \
25
		p5-IO-Compress-Zlib>=2.04:${PORTSDIR}/archivers/p5-IO-Compress-Zlib \
26
		p5-Test-Harness>=3.16:${PORTSDIR}/devel/p5-Test-Harness \
27
		${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
22
		${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
28
		${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
23
		${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
29
		${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
24
		${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
30
25
31
RUN_DEPENDS=	${BUILD_DEPENDS} \
26
RUN_DEPENDS=	${BUILD_DEPENDS}
32
		${SITE_PERL}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes
33
27
34
CONFLICTS=	ja-p5-Mail-SpamAssassin-[0-9]*
28
CONFLICTS=	ja-p5-Mail-SpamAssassin-[0-9]*
35
29
Lines 62-67 Link Here
62
56
63
.include <bsd.port.pre.mk>
57
.include <bsd.port.pre.mk>
64
58
59
.if ${PERL_LEVEL} < 501000
60
BUILD_DEPENDS+=	p5-Archive-Tar>=1.23:${PORTSDIR}/archivers/p5-Archive-Tar \
61
		p5-Compress-Zlib>=2.04:${PORTSDIR}/archivers/p5-Compress-Zlib \
62
		p5-IO-Zlib>=1.04:${PORTSDIR}/archivers/p5-IO-Zlib \
63
		p5-IO-Compress-Zlib>=2.04:${PORTSDIR}/archivers/p5-IO-Compress-Zlib \
64
		p5-Test-Harness>=3.16:${PORTSDIR}/devel/p5-Test-Harness
65
.endif
66
65
.if defined (WITH_SPAMC)
67
.if defined (WITH_SPAMC)
66
CONFIGURE_ARGS+=	BUILD_SPAMC=yes
68
CONFIGURE_ARGS+=	BUILD_SPAMC=yes
67
.else
69
.else
Lines 104-111 Link Here
104
.if defined(WITH_RAZOR)
106
.if defined(WITH_RAZOR)
105
RUN_DEPENDS+=	razor-agents>=2.84:${PORTSDIR}/mail/razor-agents
107
RUN_DEPENDS+=	razor-agents>=2.84:${PORTSDIR}/mail/razor-agents
106
.else
108
.else
107
.if !defined(WITH_DKIM)
108
.if   ${PERL_LEVEL} < 501000
109
.if   ${PERL_LEVEL} < 501000
110
.if !defined(WITH_DKIM)
109
BUILD_DEPENDS+=	p5-Digest-SHA1>=2.11:${PORTSDIR}/security/p5-Digest-SHA1
111
BUILD_DEPENDS+=	p5-Digest-SHA1>=2.11:${PORTSDIR}/security/p5-Digest-SHA1
110
.endif
112
.endif
111
.endif
113
.endif
Lines 113-119 Link Here
113
115
114
.if defined(WITH_DKIM)
116
.if defined(WITH_DKIM)
115
BUILD_DEPENDS+=	${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
117
BUILD_DEPENDS+=	${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
118
. if ${PERL_LEVEL} < 501000
116
BUILD_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/Digest/SHA.pm:${PORTSDIR}/security/p5-Digest-SHA
119
BUILD_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/Digest/SHA.pm:${PORTSDIR}/security/p5-Digest-SHA
120
. endif
117
BUILD_DEPENDS+=	p5-Mail-DKIM>=0.37:${PORTSDIR}/mail/p5-Mail-DKIM
121
BUILD_DEPENDS+=	p5-Mail-DKIM>=0.37:${PORTSDIR}/mail/p5-Mail-DKIM
118
BUILD_DEPENDS+=	p5-Crypt-OpenSSL-RSA>=0.24:${PORTSDIR}/security/p5-Crypt-OpenSSL-RSA
122
BUILD_DEPENDS+=	p5-Crypt-OpenSSL-RSA>=0.24:${PORTSDIR}/security/p5-Crypt-OpenSSL-RSA
119
.endif
123
.endif
(-)files/patch-bug6392 (+225 lines)
Added Link Here
1
Index: lib/Mail/SpamAssassin/HTML.pm
2
===================================================================
3
--- lib/Mail/SpamAssassin/HTML.pm	(revision 943932)
4
+++ lib/Mail/SpamAssassin/HTML.pm	(revision 943933)
5
@@ -191,7 +191,7 @@
6
   my $self = shift;
7
   my %options = @_;
8
 
9
-  return join('', @{ $self->{text} }) unless keys %options;
10
+  return join('', @{ $self->{text} }) unless %options;
11
 
12
   my $mask;
13
   while (my ($k, $v) = each %options) {
14
Index: lib/Mail/SpamAssassin/Dns.pm
15
===================================================================
16
--- lib/Mail/SpamAssassin/Dns.pm	(revision 943932)
17
+++ lib/Mail/SpamAssassin/Dns.pm	(revision 943933)
18
@@ -754,7 +754,7 @@
19
   dbg("dns: entering helper-app run mode");
20
   $self->{old_slash} = $/;              # Razor pollutes this
21
   %{$self->{old_env}} = ();
22
-  if ( defined %ENV ) {
23
+  if ( %ENV ) {
24
     # undefined values in %ENV can result due to autovivification elsewhere,
25
     # this prevents later possible warnings when we restore %ENV
26
     while (my ($key, $value) = each %ENV) {
27
Index: lib/Mail/SpamAssassin/Plugin/Check.pm
28
===================================================================
29
--- lib/Mail/SpamAssassin/Plugin/Check.pm	(revision 943932)
30
+++ lib/Mail/SpamAssassin/Plugin/Check.pm	(revision 943933)
31
@@ -307,64 +307,51 @@
32
   my $package_name = __PACKAGE__;
33
   my $methodname = $package_name."::_".$ruletype."_tests_".$clean_priority;
34
 
35
-  if (defined &{$methodname} && !$doing_user_rules) {
36
-run_compiled_method:
37
-  # dbg("rules: run_generic_tests - calling %s", $methodname);
38
-    my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
39
-    my $err = $t->run(sub {
40
-      no strict "refs";
41
-      $methodname->($pms, @{$opts{args}});
42
-    });
43
-    if ($t->timed_out() && $master_deadline && time > $master_deadline) {
44
-      info("check: exceeded time limit in $methodname, skipping further tests");
45
-      $pms->{deadline_exceeded} = 1;
46
-    }
47
-    return;
48
-  }
49
+  if (!defined &{$methodname} || $doing_user_rules) {
50
 
51
-  # use %nopts for named parameter-passing; it's more friendly to future-proof
52
-  # subclassing, since new parameters can be added without breaking third-party
53
-  # subclassed implementations of this plugin.
54
-  my %nopts = (
55
-    ruletype => $ruletype,
56
-    doing_user_rules => $doing_user_rules,
57
-    priority => $priority,
58
-    clean_priority => $clean_priority
59
-  );
60
+    # use %nopts for named parameter-passing; it's more friendly
61
+    # to future-proof subclassing, since new parameters can be added without
62
+    # breaking third-party subclassed implementations of this plugin.
63
+    my %nopts = (
64
+      ruletype => $ruletype,
65
+      doing_user_rules => $doing_user_rules,
66
+      priority => $priority,
67
+      clean_priority => $clean_priority
68
+    );
69
 
70
-  # build up the eval string...
71
-  $self->{evalstr_methodname} = $methodname;
72
-  $self->{evalstr_chunk_current_methodname} = undef;
73
-  $self->{evalstr_chunk_methodnames} = [];
74
-  $self->{evalstr_chunk_prefix} = [];  # stack (array) of source code sections
75
-  $self->{evalstr} = ''; $self->{evalstr_l} = 0;
76
-  $self->{evalstr2} = '';
77
-  $self->begin_evalstr_chunk($pms);
78
+    # build up the eval string...
79
+    $self->{evalstr_methodname} = $methodname;
80
+    $self->{evalstr_chunk_current_methodname} = undef;
81
+    $self->{evalstr_chunk_methodnames} = [];
82
+    $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
83
+    $self->{evalstr} = ''; $self->{evalstr_l} = 0;
84
+    $self->{evalstr2} = '';
85
+    $self->begin_evalstr_chunk($pms);
86
 
87
-  $self->push_evalstr_prefix($pms, '
88
-      # start_rules_plugin_code '.$ruletype.' '.$priority.'
89
-      my $scoresptr = $self->{conf}->{scores};
90
-  ');
91
-  if (defined $opts{pre_loop_body}) {
92
-    $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
93
-  }
94
-  $self->add_evalstr($pms,
95
-                     $self->start_rules_plugin_code($ruletype, $priority) );
96
-  while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
97
-    $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
98
-  }
99
-  if (defined $opts{post_loop_body}) {
100
-    $opts{post_loop_body}->($self, $pms, $conf, %nopts);
101
-  }
102
+    $self->push_evalstr_prefix($pms, '
103
+        # start_rules_plugin_code '.$ruletype.' '.$priority.'
104
+        my $scoresptr = $self->{conf}->{scores};
105
+    ');
106
+    if (defined $opts{pre_loop_body}) {
107
+      $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
108
+    }
109
+    $self->add_evalstr($pms,
110
+                       $self->start_rules_plugin_code($ruletype, $priority) );
111
+    while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
112
+      $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
113
+    }
114
+    if (defined $opts{post_loop_body}) {
115
+      $opts{post_loop_body}->($self, $pms, $conf, %nopts);
116
+    }
117
 
118
-  $self->flush_evalstr($pms, 'run_generic_tests');
119
-  $self->free_ruleset_source($pms, $ruletype, $priority);
120
+    $self->flush_evalstr($pms, 'run_generic_tests');
121
+    $self->free_ruleset_source($pms, $ruletype, $priority);
122
 
123
-  # clear out a previous version of this method
124
-  undef &{$methodname};
125
+    # clear out a previous version of this method
126
+    undef &{$methodname};
127
 
128
-  # generate the loop that goes through each line...
129
-  my $evalstr = <<"EOT";
130
+    # generate the loop that goes through each line...
131
+    my $evalstr = <<"EOT";
132
   {
133
     package $package_name;
134
 
135
@@ -373,41 +360,52 @@
136
     sub $methodname {
137
 EOT
138
 
139
-  for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
140
-    $evalstr .= "      $chunk_methodname(\@_);\n";
141
-  }
142
+    for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
143
+      $evalstr .= "      $chunk_methodname(\@_);\n";
144
+    }
145
 
146
-  $evalstr .= <<"EOT";
147
+    $evalstr .= <<"EOT";
148
     }
149
 
150
     1;
151
   }
152
 EOT
153
 
154
-  delete $self->{evalstr};   # free up some RAM before we eval()
155
-  delete $self->{evalstr2};
156
-  delete $self->{evalstr_methodname};
157
-  delete $self->{evalstr_chunk_current_methodname};
158
-  delete $self->{evalstr_chunk_methodnames};
159
-  delete $self->{evalstr_chunk_prefix};
160
+    delete $self->{evalstr};   # free up some RAM before we eval()
161
+    delete $self->{evalstr2};
162
+    delete $self->{evalstr_methodname};
163
+    delete $self->{evalstr_chunk_current_methodname};
164
+    delete $self->{evalstr_chunk_methodnames};
165
+    delete $self->{evalstr_chunk_prefix};
166
 
167
-  dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
168
-      $ruletype, $priority);
169
-# dbg("rules: eval code to compile: $evalstr");
170
-  my $eval_result;
171
-  { my $timer = $self->{main}->time_method('compile_gen');
172
-    $eval_result = eval($evalstr);
173
-  }
174
-  if (!$eval_result) {
175
-    my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
176
-    warn "rules: failed to compile $ruletype tests, skipping:\n".
177
-         "\t($eval_stat)\n";
178
-    $pms->{rule_errors}++;
179
-  }
180
-  else {
181
+    dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
182
+        $ruletype, $priority);
183
+  # dbg("rules: eval code to compile: $evalstr");
184
+    my $eval_result;
185
+    { my $timer = $self->{main}->time_method('compile_gen');
186
+      $eval_result = eval($evalstr);
187
+    }
188
+    if (!$eval_result) {
189
+      my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
190
+      warn "rules: failed to compile $ruletype tests, skipping:\n".
191
+           "\t($eval_stat)\n";
192
+      $pms->{rule_errors}++;
193
+      return;
194
+    }
195
     dbg("rules: compiled $ruletype tests");
196
-    goto run_compiled_method;
197
   }
198
+
199
+#run_compiled_method:
200
+# dbg("rules: run_generic_tests - calling %s", $methodname);
201
+  my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
202
+  my $err = $t->run(sub {
203
+    no strict "refs";
204
+    $methodname->($pms, @{$opts{args}});
205
+  });
206
+  if ($t->timed_out() && $master_deadline && time > $master_deadline) {
207
+    info("check: exceeded time limit in $methodname, skipping further tests");
208
+    $pms->{deadline_exceeded} = 1;
209
+  }
210
 }
211
 
212
 sub begin_evalstr_chunk {
213
Index: lib/Mail/SpamAssassin/Plugin/BodyEval.pm
214
===================================================================
215
--- lib/Mail/SpamAssassin/Plugin/BodyEval.pm	(revision 943932)
216
+++ lib/Mail/SpamAssassin/Plugin/BodyEval.pm	(revision 943933)
217
@@ -119,7 +119,7 @@
218
         }
219
 
220
 	# If there are no words, mark if there's at least 1 image ...
221
-	if (keys %html == 0 && exists $pms->{html}{inside}{img}) {
222
+	if (!%html && exists $pms->{html}{inside}{img}) {
223
 	  # Use "\n" as the mark since it can't ever occur normally
224
 	  $html{"\n"}=1;
225
 	}

Return to bug 150764