Merge ~mirespace/ubuntu/+source/libmail-dmarc-perl:noble-splitting-dependencies into ubuntu/+source/libmail-dmarc-perl:ubuntu/noble-devel

Proposed by Miriam España Acebal
Status: Work in progress
Proposed branch: ~mirespace/ubuntu/+source/libmail-dmarc-perl:noble-splitting-dependencies
Merge into: ubuntu/+source/libmail-dmarc-perl:ubuntu/noble-devel
Diff against target: 653 lines (+514/-10)
15 files modified
debian/changelog (+19/-0)
debian/control (+13/-10)
debian/patches/series (+1/-0)
debian/patches/use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch (+251/-0)
debian/tests/control (+4/-0)
debian/tests/data/nice/noneok.eml (+23/-0)
debian/tests/data/nice/quarok.eml (+23/-0)
debian/tests/data/nice/rejectok.eml (+23/-0)
debian/tests/data/nice/strictrejectok.eml (+23/-0)
debian/tests/data/spam/nodmarc.eml (+22/-0)
debian/tests/data/spam/noneko.eml (+21/-0)
debian/tests/data/spam/quarko.eml (+21/-0)
debian/tests/data/spam/rejectko.eml (+21/-0)
debian/tests/data/spam/strictrejectko.eml (+23/-0)
debian/tests/splitting-check (+26/-0)
Reviewer Review Type Date Requested Status
git-ubuntu import Pending
Review via email: mp+456713@code.launchpad.net

Description of the change

WIP- Not needed *oficial* review ... Its only for sharing the code changes

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi Miriam, I checked in on this today, installed it and reviewed the build log which looks fine. I'm not familiar with the API of any of the involved modules but not spotting any issues in your Perl code.

I like that you're being thorough with test cases. I like the sample data files, although I'd probably suggest omitting message-mattermost-hey.eml since it's so big. Make sure to scrub them of your actual email address.

I also noticed that Launchpad's diff appears to show some incorrect tabbing. I didn't comment those but you might doublecheck before sending this in for review.

A couple other notes inlined.

3dcfabe... by Miriam España Acebal

changelog-1ubuntu1

c9c9721... by Miriam España Acebal

  * Adding tests.

Unmerged commits

3dcfabe... by Miriam España Acebal

changelog-1ubuntu1

04c34a6... by Miriam España Acebal

update-maintainer

c9c9721... by Miriam España Acebal

  * Adding tests.

0c25bf8... by Miriam España Acebal

 * use MIME::Entity and MIME::Parser from libmime-tools-perl
  instead of libemail-mime-perl : added patch (d/p) and changed dependencies
  in d/control.

219bf17... by Miriam España Acebal

- d/control: Splitting Dependencies between needed in validation or reporting. The reporting ones now goes to Suggests (even the former Recommeds).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 8f886bc..0fb10d1 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,22 @@
6+libmail-dmarc-perl (1.20230215-1ubuntu1~mirespace5) noble; urgency=medium
7+
8+ * d/control: dependencies readjustment:
9+ - separate dependencies in the binary package depending on
10+ their use. Modules used in validation remain as binary
11+ dependencies and the rest, used in reporting, are moved
12+ to suggested dependencies.
13+ - drop libemail-mime-perl in favor of libmime-tools-perl and
14+ libemail-simple-perl (LP: #2030880).
15+ * d/patches: Added use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch
16+ to support refactoring to use libmime-tools-perl (LP: #2030880).
17+ * d/tests:
18+ - splitting-check: validate our dependencies split through
19+ this check. Thanks to Sergio Durigan Jr. for all the fixing here.
20+ - data/*.eml: mails used in the test (the same used by spamassassin
21+ t/dmarc.t test).
22+
23+ -- Miriam España Acebal <miriam.espana@canonical.com> Thu, 11 Dec 2023 16:43:31 +0200
24+
25 libmail-dmarc-perl (1.20230215-1) unstable; urgency=medium
26
27 * New upstream version 1.20230215
28diff --git a/debian/control b/debian/control
29index a3b621c..a70076f 100644
30--- a/debian/control
31+++ b/debian/control
32@@ -1,5 +1,6 @@
33 Source: libmail-dmarc-perl
34-Maintainer: Noah Meyerhans <noahm@debian.org>
35+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
36+XSBC-Original-Maintainer: Noah Meyerhans <noahm@debian.org>
37 Section: perl
38 Priority: optional
39 Build-Depends: debhelper-compat (= 13)
40@@ -8,10 +9,11 @@ Build-Depends-Indep: perl,
41 libfile-sharedir-perl,
42 libio-socket-ssl-perl <!nocheck>,
43 libnet-idn-encode-perl,
44- libemail-mime-perl,
45 libmodule-build-perl,
46 libtest-file-sharedir-perl,
47 libemail-sender-perl,
48+ libemail-simple-perl,
49+ libmime-tools-perl,
50 libdbix-simple-perl,
51 libdbd-sqlite3-perl,
52 libtest-exception-perl <!nocheck>,
53@@ -37,28 +39,29 @@ Depends: ${misc:Depends},
54 libconfig-tiny-perl,
55 libio-socket-ssl-perl,
56 libfile-sharedir-perl,
57+ libemail-simple-perl,
58+ libmime-tools-perl,
59 libnet-dns-perl,
60 libnet-idn-encode-perl,
61 libnet-ip-perl,
62 libnet-ssleay-perl,
63- libemail-mime-perl,
64- libtest-file-sharedir-perl,
65- libemail-sender-perl,
66- libdbix-simple-perl,
67- libdbd-sqlite3-perl,
68- libtest-output-perl,
69 libregexp-common-perl,
70 libsocket6-perl,
71 liburi-perl,
72 libxml-libxml-perl,
73- publicsuffix,
74-Recommends:
75+ publicsuffix,
76+Suggests:
77 libjson-perl,
78 libmail-dkim-perl,
79 libnet-http-perl,
80 libnet-imap-simple-perl,
81 libnet-server-perl,
82 libnet-smtps-perl,
83+ libdbd-sqlite3-perl,
84+ libdbix-simple-perl,
85+ libemail-sender-perl,
86+ libtest-file-sharedir-perl,
87+ libtest-output-perl,
88 Description: Perl implementation of DMARC
89 Mail::DMARC is a suite of tools for implementing DMARC. It adheres to the
90 2013 DMARC draft, intending to implement every MUST and every SHOULD.
91diff --git a/debian/patches/series b/debian/patches/series
92index ff0a249..78675e7 100644
93--- a/debian/patches/series
94+++ b/debian/patches/series
95@@ -1,3 +1,4 @@
96 0001-pod-Fix-missing-and-malformed-NAME-headings.patch
97 0005-recommend-system-psl.patch
98 skip_network_tests.patch
99+use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch
100diff --git a/debian/patches/use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch b/debian/patches/use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch
101new file mode 100644
102index 0000000..96ae2df
103--- /dev/null
104+++ b/debian/patches/use-MIME-Entity-and-MIME-Parser-from-libmime-tools-p.patch
105@@ -0,0 +1,251 @@
106+Description: use MIME::Entity and MIME::Parser from libmime-tools-perl
107+ instead of libemail-mime-perl
108+Author: Miriam Espana Acebal <miriam.espana@canonical.com>
109+Date: Fri, 1 Dec 2023 23:36:20 +0100
110+Bug-ubuntu: https://bugs.launchpad.net/bugs/2030880
111+Forwarded: no
112+---
113+ Build.PL | 3 +-
114+ META.json | 3 +-
115+ META.yml | 3 +-
116+ Makefile.PL | 3 +-
117+ lib/Mail/DMARC/Report/Receive.pm | 10 ++--
118+ lib/Mail/DMARC/Report/Send/SMTP.pm | 83 +++++++++++++-----------------
119+ 6 files changed, 49 insertions(+), 56 deletions(-)
120+
121+Index: libmail-dmarc-perl/Build.PL
122+===================================================================
123+--- libmail-dmarc-perl.orig/Build.PL 2023-12-12 13:25:40.554260151 +0100
124++++ libmail-dmarc-perl/Build.PL 2023-12-12 13:34:31.661666249 +0100
125+@@ -35,7 +35,6 @@
126+ "DBD::SQLite" => "1.31",
127+ "DBIx::Simple" => "1.35",
128+ "Data::Dumper" => 0,
129+- "Email::MIME" => 0,
130+ "Email::Sender" => 0,
131+ "Email::Sender::Simple" => "1.300032",
132+ "Email::Simple" => 0,
133+@@ -50,6 +49,10 @@
134+ "IO::Socket::SSL" => 0,
135+ "IO::Uncompress::Gunzip" => 0,
136+ "IO::Uncompress::Unzip" => 0,
137++ "Mail::Field" => 0,
138++ "Mail::Internet" => 0,
139++ "MIME::Entity" => 0,
140++ "MIME::Parser" => 0,
141+ "Net::DNS::Resolver" => 0,
142+ "Net::IDN::Encode" => 0,
143+ "Net::IP" => 0,
144+Index: libmail-dmarc-perl/META.json
145+===================================================================
146+--- libmail-dmarc-perl.orig/META.json 2023-12-12 13:25:40.554260151 +0100
147++++ libmail-dmarc-perl/META.json 2023-12-12 13:36:22.713205589 +0100
148+@@ -39,7 +39,6 @@
149+ "DBD::SQLite" : "1.31",
150+ "DBIx::Simple" : "1.35",
151+ "Data::Dumper" : "0",
152+- "Email::MIME" : "0",
153+ "Email::Sender" : "0",
154+ "Email::Sender::Simple" : "1.300032",
155+ "Email::Simple" : "0",
156+@@ -54,6 +53,10 @@
157+ "IO::Socket::SSL" : "0",
158+ "IO::Uncompress::Gunzip" : "0",
159+ "IO::Uncompress::Unzip" : "0",
160++ "Mail::Field" : "0",
161++ "Mail::Internet" : "0",
162++ "MIME::Entity" : "0",
163++ "MIME::Parser" : "0",
164+ "Net::DNS::Resolver" : "0",
165+ "Net::IDN::Encode" : "0",
166+ "Net::IP" : "0",
167+Index: libmail-dmarc-perl/META.yml
168+===================================================================
169+--- libmail-dmarc-perl.orig/META.yml 2023-12-12 13:25:40.554260151 +0100
170++++ libmail-dmarc-perl/META.yml 2023-12-12 13:37:35.244866669 +0100
171+@@ -116,7 +116,6 @@
172+ DBD::SQLite: '1.31'
173+ DBIx::Simple: '1.35'
174+ Data::Dumper: '0'
175+- Email::MIME: '0'
176+ Email::Sender: '0'
177+ Email::Sender::Simple: '1.300032'
178+ Email::Simple: '0'
179+@@ -131,6 +130,10 @@
180+ IO::Socket::SSL: '0'
181+ IO::Uncompress::Gunzip: '0'
182+ IO::Uncompress::Unzip: '0'
183++ Mail::Field : '0'
184++ Mail::Internet : '0'
185++ MIME::Entity: '0'
186++ MIME::Parser: '0'
187+ Net::DNS::Resolver: '0'
188+ Net::IDN::Encode: '0'
189+ Net::IP: '0'
190+Index: libmail-dmarc-perl/Makefile.PL
191+===================================================================
192+--- libmail-dmarc-perl.orig/Makefile.PL 2023-12-12 13:25:40.554260151 +0100
193++++ libmail-dmarc-perl/Makefile.PL 2023-12-12 13:34:47.101606901 +0100
194+@@ -54,7 +54,6 @@
195+ "DBD::SQLite" => "1.31",
196+ "DBIx::Simple" => "1.35",
197+ "Data::Dumper" => 0,
198+- "Email::MIME" => 0,
199+ "Email::Sender" => 0,
200+ "Email::Sender::Simple" => "1.300032",
201+ "Email::Simple" => 0,
202+@@ -69,6 +68,10 @@
203+ "IO::Socket::SSL" => 0,
204+ "IO::Uncompress::Gunzip" => 0,
205+ "IO::Uncompress::Unzip" => 0,
206++ "Mail::Field" => 0,
207++ "Mail::Internet" => 0,
208++ "MIME::Entity" => 0,
209++ "MIME::Parser" => 0,
210+ "Net::DNS::Resolver" => 0,
211+ "Net::IDN::Encode" => 0,
212+ "Net::IP" => 0,
213+Index: libmail-dmarc-perl/lib/Mail/DMARC/Report/Receive.pm
214+===================================================================
215+--- libmail-dmarc-perl.orig/lib/Mail/DMARC/Report/Receive.pm 2023-12-12 13:25:40.554260151 +0100
216++++ libmail-dmarc-perl/lib/Mail/DMARC/Report/Receive.pm 2023-12-12 13:25:40.538260108 +0100
217+@@ -6,7 +6,7 @@
218+
219+ use Carp;
220+ use Data::Dumper;
221+-use Email::MIME;
222++use MIME::Parser;
223+ use Email::Simple;
224+ use Encode;
225+ use IO::Uncompress::Unzip;
226+@@ -137,8 +137,10 @@
227+ };
228+
229+ my $rep_type;
230+- foreach my $part ( Email::MIME->new( $email->as_string )->parts ) {
231+- my ($c_type) = split /;/, $part->content_type || '';
232++ my $parser = MIME::Parser->new;
233++ foreach my $part ( $parser->parse( $email->as_string )->parts_DFS ) {
234++ next if defined(!$part->bodyhandle); # something to process
235++ my ($c_type) = split /;/, $part->effective_type || '';
236+ next if $c_type eq 'text/plain';
237+ if ( $c_type eq 'text/rfc822-headers' ) {
238+ warn "TODO: handle forensic reports\n"; ## no critic (Carp)
239+@@ -151,7 +153,7 @@
240+ next;
241+ }
242+ my $bigger;
243+- my $filename = $part->{ct}{attributes}{name} || '';
244++ my $filename = $part->head->recommended_filename || $part->bodyhandle->path || '';
245+
246+ if ( $c_type eq 'application/zip' || $c_type eq 'application/x-zip-compressed' ) {
247+ $self->get_submitter_from_filename( $filename );
248+Index: libmail-dmarc-perl/lib/Mail/DMARC/Report/Send/SMTP.pm
249+===================================================================
250+--- libmail-dmarc-perl.orig/lib/Mail/DMARC/Report/Send/SMTP.pm 2023-12-12 13:25:40.554260151 +0100
251++++ libmail-dmarc-perl/lib/Mail/DMARC/Report/Send/SMTP.pm 2023-12-12 13:25:40.550260140 +0100
252+@@ -6,7 +6,7 @@
253+
254+ use Carp;
255+ use English '-no_match_vars';
256+-use Email::MIME;
257++use MIME::Entity;
258+ #use Mail::Sender; # something to consider
259+ use Sys::Hostname;
260+ use POSIX;
261+@@ -115,24 +115,20 @@
262+ sub assemble_too_big_message_object {
263+ my ( $self, $to, $body ) = @_;
264+
265+- my @parts = Email::MIME->create(
266+- attributes => {
267+- content_type => "text/plain",
268+- disposition => "inline",
269+- charset => "US-ASCII",
270+- },
271+- body => $body,
272+- ) or croak "unable to add body!";
273+-
274+- my $email = Email::MIME->create(
275+- header_str => [
276+- From => $self->config->{organization}{email},
277+- To => $to,
278+- Date => $self->get_timestamp_rfc2822,
279+- Subject => 'DMARC too big report',
280+- ],
281+- parts => [@parts],
282+- ) or croak "unable to assemble message\n";
283++ my $email = MIME::Entity->build(
284++ Type => "multipart/mixed",
285++ From => $self->config->{organization}{email},
286++ To => $to,
287++ Date => $self->get_timestamp_rfc2822,
288++ Subject => 'DMARC too big report'
289++ ) or croak "unable to create header!";;
290++
291++ $email->attach(
292++ Type => "text/plain",
293++ Disposition => "inline",
294++ Charset => "US-ASCII",
295++ Data => $body,
296++ ) or croak "unable to add body and assemble message!";
297+
298+ return $email;
299+ }
300+@@ -146,35 +142,27 @@
301+ my $cf = 'gzip';
302+ $filename .= $cf eq 'gzip' ? '.gz' : '.zip';
303+
304+- my @parts = Email::MIME->create(
305+- attributes => {
306+- content_type => "text/plain",
307+- disposition => "inline",
308+- charset => "US-ASCII",
309+- },
310+- body => $self->human_summary( $agg_ref ),
311+- ) or croak "unable to add body!";
312+-
313+- push @parts,
314+- Email::MIME->create(
315+- attributes => {
316+- filename => $filename,
317+- content_type => "application/$cf",
318+- encoding => "base64",
319+- name => $filename,
320+- },
321+- body => $shrunk,
322+- ) or croak "unable to add report!";
323+-
324+- my $email = Email::MIME->create(
325+- header_str => [
326+- From => $self->config->{organization}{email},
327+- To => $to,
328+- Date => $self->get_timestamp_rfc2822,
329+- Subject => $self->get_subject( $agg_ref ),
330+- ],
331+- parts => [@parts],
332+- ) or croak "unable to assemble message\n";
333++ my $email = MIME::Entity->build(
334++ Type => "multipart/mixed",
335++ From => $self->config->{organization}{email},
336++ To => $to,
337++ Date => $self->get_timestamp_rfc2822,
338++ Subject => $self->get_subject( $agg_ref )
339++ ) or croak "unable to create header!";;
340++
341++ $email->attach(
342++ Type => "text/plain",
343++ Disposition => "inline",
344++ Charset => "US-ASCII",
345++ Data => \$self->human_summary( $agg_ref ),
346++ ) or croak "unable to add body to message!";
347++
348++ $email->attach(
349++ Type => "application/$cf",
350++ Encoding => "base64",
351++ Filename => $filename,
352++ Data => \$shrunk,
353++ ) or croak "unable to add report to message!";
354+
355+ return $email;
356+ }
357diff --git a/debian/tests/control b/debian/tests/control
358new file mode 100644
359index 0000000..04e9ccd
360--- /dev/null
361+++ b/debian/tests/control
362@@ -0,0 +1,4 @@
363+Tests: splitting-check
364+Depends: @, spamassassin, spamc, spamd
365+Restrictions: needs-root
366+
367diff --git a/debian/tests/data/nice/noneok.eml b/debian/tests/data/nice/noneok.eml
368new file mode 100644
369index 0000000..965a921
370--- /dev/null
371+++ b/debian/tests/data/nice/noneok.eml
372@@ -0,0 +1,23 @@
373+Return-Path: <test@dmarc1.spamassassin.org>
374+Received: from dmarc1.spamassassin.org (dmarc1.spamassassin.org [64.142.3.173])
375+ by dmarc1.spamassassin.org (8.14.9/8.14.9) with ESMTP id 13DFe22R006047
376+ (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
377+ Tue, 13 Apr 2021 11:40:02 -0400
378+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=
379+ dmarc1.spamassassin.org; h=from:to:subject:message-id:date
380+ :mime-version:content-type; s=selector1; bh=AaYQYg3XpWgPk5P7okfW
381+ fbeh0V4=; b=jxH2H2N0++4M6VJ/tebY0f+GOMteGMsjcHkP1S+oTE8657JmosdR
382+ S1VXtcJ5CwrXNTxe+9oW1bdU6QVL8fe7I1i2fXIEShaw6js+l5ymbvWts8o9kHZH
383+ Jv8+ZfwaSkmr6onD679oTxBFGOT0PkI33kQOoZnVQY9xF73vZXEA7NoWg0rmaGcT
384+ up8zinkgQV6BhdqJGzzi3je4QOdDgVmp1Pj42aaliurC0HlFZT/xAF0OZKVzwm3I
385+ J2dlpC84zKIlqa9vGnx16N1wIyA+/GnpJ13s4hg9N7PrAi7iotanBh0W+v/ujLnr
386+ MTjXJ11pMzp8xvoXtt3c+Ptxbf7TW4BxKA==
387+From: SpamAssassin Test <test@dmarc1.spamassassin.org>
388+To: undisclosed-recipients:;
389+Subject: test message 1
390+Message-ID: <4A294538.10002@dmarc1.spamassassin.org>
391+Date: Sun, 11 Apr 2021 02:00:04 +0000
392+MIME-Version: 1.0
393+Content-Type: text/plain; charset=us-ascii
394+
395+test message
396diff --git a/debian/tests/data/nice/quarok.eml b/debian/tests/data/nice/quarok.eml
397new file mode 100644
398index 0000000..7075137
399--- /dev/null
400+++ b/debian/tests/data/nice/quarok.eml
401@@ -0,0 +1,23 @@
402+Return-Path: <test@dmarc2.spamassassin.org>
403+Received: from dmarc2.spamassassin.org (dmarc2.spamassassin.org [64.142.3.173])
404+ by dmarc2.spamassassin.org (8.14.9/8.14.9) with ESMTP id 13DFe22R006047
405+ (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
406+ Tue, 13 Apr 2021 11:40:02 -0400
407+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=
408+ dmarc2.spamassassin.org; h=from:to:subject:message-id:date
409+ :mime-version:content-type; s=selector1; bh=AaYQYg3XpWgPk5P7okfW
410+ fbeh0V4=; b=2T58S24T2pMH5xPY2FB3YYH9qvdyXg6KZUIhNnj0bHFkmLbZWsYN
411+ lMdfQojRifSwD28tN8tljiKE9tdwNJeWj8sy6hGzvw5ksGjvAHjb46ZifWi9oD+7
412+ 2ddAvVgKSV/wtVhg5dZCimNdDq3irKOQ881mPHuzdcXxEsNxYJUMR/989HTvdYLA
413+ eJAcT00hum1LdL+wdxZiG/JyC0G5mThARi/b3KdC7MV8DukO3pSRJjWsIgnEJNna
414+ +F7YCCJbp6Rm32HyUayYbov3ZMZ6MFzN9sYUkej/gUTl8LMacW3ibCcleeVD4oKN
415+ ksOe+bE0CAevco5lyqSEjSAXigBAGoV2ow==
416+From: SpamAssassin Test <test@dmarc2.spamassassin.org>
417+To: undisclosed-recipients:;
418+Subject: test message 1
419+Message-ID: <4A294538.10002@dmarc2.spamassassin.org>
420+Date: Sun, 11 Apr 2021 02:00:04 +0000
421+MIME-Version: 1.0
422+Content-Type: text/plain; charset=us-ascii
423+
424+test message
425diff --git a/debian/tests/data/nice/rejectok.eml b/debian/tests/data/nice/rejectok.eml
426new file mode 100644
427index 0000000..abf3603
428--- /dev/null
429+++ b/debian/tests/data/nice/rejectok.eml
430@@ -0,0 +1,23 @@
431+Return-Path: <test@dmarc3.spamassassin.org>
432+Received: from dmarc3.spamassassin.org (dmarc3.spamassassin.org [64.142.3.173])
433+ by dmarc3.spamassassin.org (8.14.9/8.14.9) with ESMTP id 13DFe22R006047
434+ (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
435+ Tue, 13 Apr 2021 11:40:02 -0400
436+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=
437+ dmarc3.spamassassin.org; h=from:to:subject:message-id:date
438+ :mime-version:content-type; s=selector1; bh=AaYQYg3XpWgPk5P7okfW
439+ fbeh0V4=; b=SfeRUmdB+35RaFj+etCrogC358LU4jiyF7Oa7Qsp+kp3rV++gfSG
440+ 6NKWuGAAbY+sA3M1m8KBXZXavPzmLRcZaorgVuHdmnsF+/5Fzmz6DBOSKhcM54p2
441+ 1CfeiJAz0Rcudbxq9c3OJYlu1iSXDw1YwflRDgWv+Sed9T0jWmti1//N66NTZEKc
442+ 2O6EyI6KuBPUvRHRD04GBCAUweiM9HR4rVIDA9H7HFFPlVfB6Gm6iNhHy1tsuDSJ
443+ +1wMJcojXrdRje8QC6bIyQLsY7/H4X0tUbjXNHhC4d2oA0WQQ7mvVGWhtFQFDfIx
444+ G30/NRr8NICgPhjp91rAIXU9dKgdohdnWg==
445+From: SpamAssassin Test <test@dmarc3.spamassassin.org>
446+To: undisclosed-recipients:;
447+Subject: test message 1
448+Message-ID: <4A294538.10002@dmarc3.spamassassin.org>
449+Date: Sun, 11 Apr 2021 02:00:04 +0000
450+MIME-Version: 1.0
451+Content-Type: text/plain; charset=us-ascii
452+
453+test message
454diff --git a/debian/tests/data/nice/strictrejectok.eml b/debian/tests/data/nice/strictrejectok.eml
455new file mode 100644
456index 0000000..f1edb89
457--- /dev/null
458+++ b/debian/tests/data/nice/strictrejectok.eml
459@@ -0,0 +1,23 @@
460+Return-Path: <test@dmarc4.spamassassin.org>
461+Received: from dmarc4.spamassassin.org (dmarc4.spamassassin.org [64.142.3.173])
462+ by dmarc4.spamassassin.org (8.14.9/8.14.9) with ESMTP id 13DFe22R006047
463+ (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
464+ Tue, 13 Apr 2021 11:40:02 -0400
465+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=
466+ dmarc4.spamassassin.org; h=from:to:subject:message-id:date
467+ :mime-version:content-type; s=selector1; bh=AaYQYg3XpWgPk5P7okfW
468+ fbeh0V4=; b=0KPynqQB29CX6l5kp6+/x/HT7iTSC1G/u6yZJP0n/JpoqPVOvmbJ
469+ l3/U36gxCHPxz1D7dFWBgU2chDkAlTcz/+TkKF4jcta8pPsLTsbaJH6egS0krT+4
470+ ydMeck2W98pj2zgh2yz25VqAP418y0EP/1QqlSDckjUayVRz3xakPVGX8fp4iIB4
471+ lQ08239wyqHua0mJxjQuqi/Xr6qDxaPPJOs/U9+ToKrLlKuLw0LC2VGlzsttTt5z
472+ 8OBBIGfda0srAASmuwpyeilyFieaMAnpBuI1RAW0H5Ol8mqUjy8rjNKvoIPfZSUN
473+ hSDpuUAc9u58kcZZ0TSmodXazPYne4JlLw=
474+From: SpamAssassin Test <test@dmarc4.spamassassin.org>
475+To: undisclosed-recipients:;
476+Subject: test message 1
477+Message-ID: <4A294538.10002@dmarc4.spamassassin.org>
478+Date: Sun, 11 Apr 2021 02:00:04 +0000
479+MIME-Version: 1.0
480+Content-Type: text/plain; charset=us-ascii
481+
482+test message
483diff --git a/debian/tests/data/spam/nodmarc.eml b/debian/tests/data/spam/nodmarc.eml
484new file mode 100644
485index 0000000..0ad2e96
486--- /dev/null
487+++ b/debian/tests/data/spam/nodmarc.eml
488@@ -0,0 +1,22 @@
489+Return-Path: <newsalerts-noreply@dnsbltest.spamassassin.org>
490+Received: from dnsbltest.spamassassin.org (dnsbltest.spamassassin.org [65.214.43.157]) by amgod.boxhost.net (Postfix) with SMTP id B9B2931016D for <jm-google-news-alerts@jmason.org>; Tue, 10 Feb 2004 18:18:49 +0000 (GMT)
491+Received: by proxy.google.com with SMTP id so1951389 for <jm-google-news-alerts@jmason.org>; Tue, 10 Feb 2004 10:14:01 -0800 (PST)
492+Received: by abbulk2 with SMTP id mr733125; Tue, 10 Feb 2004 10:14:01 -0800 (PST)
493+Message-ID: <1076436841.67074.8fa05ccdc458abe5.1446041b@persist.google.com>
494+Date: Tue, 10 Feb 2004 10:14:01 -0800 (PST)
495+From: newsalerts-noreply@dnsbltest.spamassassin.org
496+To: jm-google-news-alerts@jmason.org
497+Subject: Google News Alert - spamassassin
498+MIME-Version: 1.0
499+Content-Type: text/plain; charset="ISO-8859-1";
500+
501+SWSOFT Unveils Plesk 7, Deployed by 1&1
502+Web Host Industry Review - USA
503+... The software also features a newly designed Windows XP-like user interface,
504+is equipped SpamAssassin, an open source anti-spam tool, and includes
505+"Application ...
506+<http://thewhir.com/marketwatch/sws021004.cfm>
507+See all stories on this topic:
508+<http://news.google.com/news?hl=en&lr=&ie=UTF-8&oe=utf8&client=google&num=30&newsc
509+lusterurl=http://thewhir.com/marketwatch/sws021004.cfm>
510+
511diff --git a/debian/tests/data/spam/noneko.eml b/debian/tests/data/spam/noneko.eml
512new file mode 100644
513index 0000000..09edf41
514--- /dev/null
515+++ b/debian/tests/data/spam/noneko.eml
516@@ -0,0 +1,21 @@
517+Return-Path: <test@dmarc1.spamassassin.org>
518+Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432])
519+ (using TLSv1.3 with cipher AEAD-AES128-GCM-SHA256 (128/128 bits))
520+ (No client certificate requested)
521+ by dmarc1.spamassassin.org (Postfix) with ESMTPS id EDD4E2073D
522+ for <test@dmarc1.spamassassin.org>; Tue, 15 Jun 2021 11:55:45 +0200 (CEST)
523+Received: from PC ([2409:4063:231e:c527:1997:664a:34e5:7d88])
524+ by smtp.gmail.com with ESMTPSA id n23sm15339981pgv.76.2021.06.15.02.55.37
525+ for <test@dmarc1.spamassassin.org>
526+ (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128);
527+ Tue, 15 Jun 2021 02:55:43 -0700 (PDT)
528+Message-ID: <1076436841.67074.8fa05ccdc458abe5.1446041b@persist.google.com>
529+From: SpamAssassin Test <test@dmarc1.spamassassin.org>
530+To: undisclosed-recipients:;
531+Subject: test message 1
532+Message-ID: <4A294538.10002@dmarc1.spamassassin.org>
533+Date: Mon, 08 Jun 2009 12:00:00 +0000
534+MIME-Version: 1.0
535+Content-Type: text/plain; charset=us-ascii
536+
537+testing
538diff --git a/debian/tests/data/spam/quarko.eml b/debian/tests/data/spam/quarko.eml
539new file mode 100644
540index 0000000..5fc5351
541--- /dev/null
542+++ b/debian/tests/data/spam/quarko.eml
543@@ -0,0 +1,21 @@
544+Return-Path: <test@dmarc2.spamassassin.org>
545+Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432])
546+ (using TLSv1.3 with cipher AEAD-AES128-GCM-SHA256 (128/128 bits))
547+ (No client certificate requested)
548+ by dmarc2.spamassassin.org (Postfix) with ESMTPS id EDD4E2073D
549+ for <test@dmarc2.spamassassin.org>; Tue, 15 Jun 2021 11:55:45 +0200 (CEST)
550+Received: from PC ([2409:4063:231e:c527:1997:664a:34e5:7d88])
551+ by smtp.gmail.com with ESMTPSA id n23sm15339981pgv.76.2021.06.15.02.55.37
552+ for <test@dmarc2.spamassassin.org>
553+ (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128);
554+ Tue, 15 Jun 2021 02:55:43 -0700 (PDT)
555+Message-ID: <1076436841.67074.8fa05ccdc458abe5.1446041b@persist.google.com>
556+From: SpamAssassin Test <test@dmarc2.spamassassin.org>
557+To: undisclosed-recipients:;
558+Subject: test message 1
559+Message-ID: <4A294538.10002@dmarc2.spamassassin.org>
560+Date: Mon, 08 Jun 2009 12:00:00 +0000
561+MIME-Version: 1.0
562+Content-Type: text/plain; charset=us-ascii
563+
564+testing
565diff --git a/debian/tests/data/spam/rejectko.eml b/debian/tests/data/spam/rejectko.eml
566new file mode 100644
567index 0000000..b3c0009
568--- /dev/null
569+++ b/debian/tests/data/spam/rejectko.eml
570@@ -0,0 +1,21 @@
571+Return-Path: <test@dmarc3.spamassassin.org>
572+Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432])
573+ (using TLSv1.3 with cipher AEAD-AES128-GCM-SHA256 (128/128 bits))
574+ (No client certificate requested)
575+ by dmarc3.spamassassin.org (Postfix) with ESMTPS id EDD4E2073D
576+ for <test@dmarc3.spamassassin.org>; Tue, 15 Jun 2021 11:55:45 +0200 (CEST)
577+Received: from PC ([2409:4063:231e:c527:1997:664a:34e5:7d88])
578+ by smtp.gmail.com with ESMTPSA id n23sm15339981pgv.76.2021.06.15.02.55.37
579+ for <test@dmarc3.spamassassin.org>
580+ (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128);
581+ Tue, 15 Jun 2021 02:55:43 -0700 (PDT)
582+Message-ID: <1076436841.67074.8fa05ccdc458abe5.1446041b@persist.google.com>
583+From: SpamAssassin Test <test@dmarc3.spamassassin.org>
584+To: undisclosed-recipients:;
585+Subject: test message 1
586+Message-ID: <4A294538.10002@dmarc3.spamassassin.org>
587+Date: Mon, 08 Jun 2009 12:00:00 +0000
588+MIME-Version: 1.0
589+Content-Type: text/plain; charset=us-ascii
590+
591+testing
592diff --git a/debian/tests/data/spam/strictrejectko.eml b/debian/tests/data/spam/strictrejectko.eml
593new file mode 100644
594index 0000000..edbec9a
595--- /dev/null
596+++ b/debian/tests/data/spam/strictrejectko.eml
597@@ -0,0 +1,23 @@
598+Return-Path: <test@dmarc4.spamassassin.org>
599+Received: from dmarc4.spamassassin.org (dmarc4.spamassassin.org [1.2.3.4])
600+ by dmarc4.spamassassin.org (8.14.9/8.14.9) with ESMTP id 13DFe22R006047
601+ (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO);
602+ Tue, 13 Apr 2021 11:40:02 -0400
603+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=
604+ dmarc4.spamassassin.org; h=from:to:subject:message-id:date
605+ :mime-version:content-type; s=dkim; bh=vxHXq7bMZ9+UHGuKBsbQKsDHm
606+ mk=; b=Gm/CB7JaShGbluYAiHOBX0CcOvye9210Tghzmuvya0j0EF7dfJH8I9+wc
607+ zFxo4JdBQ6xoq6zXwOLU8pVcpDtxrOzIPkidkVsI1iDi7tApONTuG9JW/vVNId/J
608+ RBsp8Z2gi5vO07L2dtcZEIVOXM1MKN/69gXiGY3TbyhO63iFno04nAQFHooQYdqk
609+ a6C8s0n3AVfPEE4cbTit67kREHVm+ZMQpd281BUh9zOftfL+R7VEWWSnSz5EmeBU
610+ MihnFhg5DpEAIFyJ9ZqspI4CG0gAiRzd+Ol2ciJOAhm/hcqn3/J0YPqtN/1Cl7I2
611+ jrtCRUnSpndamKLJp1aLWibYYkbwQ==
612+From: SpamAssassin Test <test@dmarc4.spamassassin.org>
613+To: undisclosed-recipients:;
614+Subject: test message 1
615+Message-ID: <4A294538.10002@dmarc4.spamassassin.org>
616+Date: Sun, 11 Apr 2021 02:00:04 +0000
617+MIME-Version: 1.0
618+Content-Type: text/plain; charset=us-ascii
619+
620+test message
621diff --git a/debian/tests/splitting-check b/debian/tests/splitting-check
622new file mode 100644
623index 0000000..11802dd
624--- /dev/null
625+++ b/debian/tests/splitting-check
626@@ -0,0 +1,26 @@
627+#!/bin/bash
628+
629+set -eo pipefail
630+
631+check_dmarc_policy_reporting(){
632+ local eml="${1}"
633+ local policy="${2}"
634+
635+ spamc -R < "${eml}" | grep -qF DMARC_"${policy}"
636+
637+}
638+
639+for m in $(find debian/tests/data/nice/ -type f); do
640+ check_dmarc_policy_reporting "${m}" "PASS"
641+done
642+
643+declare -A EXPECTED_RESULT
644+EXPECTED_RESULT["nodmarc.eml"]="MISSING"
645+EXPECTED_RESULT["noneko.eml"]="NONE"
646+EXPECTED_RESULT["quarko.eml"]="QUAR"
647+EXPECTED_RESULT["rejectko.eml"]="REJECT"
648+EXPECTED_RESULT["strictrejectko.eml"]="REJECT"
649+
650+for m in ${!EXPECTED_RESULT[@]}; do
651+ check_dmarc_policy_reporting "debian/tests/data/spam/${m}" "${EXPECTED_RESULT[${m}]}"
652+done
653\ No newline at end of file

Subscribers

People subscribed via source and target branches