sup 0.22.1 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/checks.yml +70 -0
  3. data/.gitignore +1 -3
  4. data/.rubocop.yml +5 -0
  5. data/CONTRIBUTORS +14 -5
  6. data/Gemfile +6 -1
  7. data/History.txt +76 -0
  8. data/Manifest.txt +149 -0
  9. data/README.md +32 -5
  10. data/Rakefile +40 -1
  11. data/bin/sup +7 -5
  12. data/bin/sup-add +16 -20
  13. data/bin/sup-config +30 -44
  14. data/bin/sup-dump +2 -2
  15. data/bin/sup-import-dump +4 -4
  16. data/bin/sup-sync +3 -3
  17. data/bin/sup-sync-back-maildir +2 -2
  18. data/bin/sup-tweak-labels +5 -5
  19. data/ext/mkrf_conf_xapian.rb +10 -4
  20. data/lib/sup/colormap.rb +1 -1
  21. data/lib/sup/crypto.rb +17 -8
  22. data/lib/sup/hook.rb +9 -9
  23. data/lib/sup/index.rb +20 -7
  24. data/lib/sup/keymap.rb +1 -1
  25. data/lib/sup/logger.rb +1 -1
  26. data/lib/sup/maildir.rb +4 -4
  27. data/lib/sup/mbox.rb +4 -4
  28. data/lib/sup/message.rb +26 -15
  29. data/lib/sup/message_chunks.rb +29 -20
  30. data/lib/sup/mode.rb +1 -0
  31. data/lib/sup/modes/completion_mode.rb +0 -1
  32. data/lib/sup/modes/contact_list_mode.rb +1 -0
  33. data/lib/sup/modes/file_browser_mode.rb +2 -2
  34. data/lib/sup/modes/label_list_mode.rb +1 -1
  35. data/lib/sup/modes/reply_mode.rb +3 -1
  36. data/lib/sup/modes/search_list_mode.rb +2 -2
  37. data/lib/sup/modes/thread_index_mode.rb +1 -1
  38. data/lib/sup/modes/thread_view_mode.rb +15 -13
  39. data/lib/sup/rfc2047.rb +21 -6
  40. data/lib/sup/source.rb +9 -3
  41. data/lib/sup/textfield.rb +0 -1
  42. data/lib/sup/thread.rb +0 -1
  43. data/lib/sup/util/axe.rb +17 -0
  44. data/lib/sup/util/ncurses.rb +3 -3
  45. data/lib/sup/util.rb +42 -67
  46. data/lib/sup/version.rb +10 -1
  47. data/lib/sup.rb +13 -8
  48. data/man/sup-add.1 +34 -55
  49. data/man/sup-config.1 +23 -36
  50. data/man/sup-dump.1 +25 -35
  51. data/man/sup-import-dump.1 +33 -54
  52. data/man/sup-psych-ify-config-files.1 +25 -34
  53. data/man/sup-recover-sources.1 +34 -49
  54. data/man/sup-sync-back-maildir.1 +39 -60
  55. data/man/sup-sync.1 +49 -79
  56. data/man/sup-tweak-labels.1 +35 -58
  57. data/man/sup.1 +50 -62
  58. data/sup.gemspec +12 -9
  59. data/test/dummy_source.rb +21 -15
  60. data/test/fixtures/embedded-message.eml +34 -0
  61. data/test/fixtures/mailing-list-header.eml +80 -0
  62. data/test/fixtures/non-ascii-header-in-nested-message.eml +36 -0
  63. data/test/fixtures/non-ascii-header.eml +8 -0
  64. data/test/fixtures/rfc2047-header-encoding.eml +15 -0
  65. data/test/fixtures/text-attachments-with-charset.eml +60 -0
  66. data/test/fixtures/utf8-header.eml +17 -0
  67. data/test/fixtures/zimbra-quote-with-bottom-post.eml +27 -0
  68. data/test/gnupg_test_home/gpg.conf +2 -1
  69. data/test/gnupg_test_home/private-keys-v1.d/306D2EE90FF0014B5B9FD07E265C751791674140.key +0 -0
  70. data/test/gnupg_test_home/pubring.gpg +0 -0
  71. data/test/gnupg_test_home/receiver_pubring.gpg +0 -0
  72. data/test/gnupg_test_home/receiver_secring.gpg +0 -0
  73. data/test/gnupg_test_home/regen_keys.sh +69 -18
  74. data/test/gnupg_test_home/secring.gpg +0 -0
  75. data/test/gnupg_test_home/sup-test-2@foo.bar.asc +20 -22
  76. data/test/integration/test_mbox.rb +1 -1
  77. data/test/integration/test_sup-add.rb +83 -0
  78. data/test/test_crypto.rb +46 -0
  79. data/test/test_header_parsing.rb +9 -1
  80. data/test/test_helper.rb +7 -4
  81. data/test/test_message.rb +188 -22
  82. data/test/test_messages_dir.rb +13 -15
  83. data/test/unit/test_horizontal_selector.rb +4 -4
  84. data/test/unit/test_locale_fiddler.rb +1 -1
  85. data/test/unit/util/test_query.rb +10 -4
  86. data/test/unit/util/test_string.rb +9 -3
  87. data/test/unit/util/test_uri.rb +2 -2
  88. metadata +93 -51
  89. data/.travis.yml +0 -13
  90. data/bin/sup-psych-ify-config-files +0 -21
  91. data/test/gnupg_test_home/key1.gen +0 -15
  92. data/test/gnupg_test_home/key2.gen +0 -15
  93. data/test/gnupg_test_home/key_ecc.gen +0 -13
  94. data/test/gnupg_test_home/private-keys-v1.d/719C7455A7169C6EE8819C6E91002E4F9DD00A65.key +0 -1
  95. data/test/gnupg_test_home/private-keys-v1.d/8A130806A754AA29D59487D76BD355040D9F26C0.key +0 -0
  96. data/test/gnupg_test_home/private-keys-v1.d/B7AA46B22BD8A6AD1B4F266C19A3B124A32DDD71.key +0 -0
  97. data/test/gnupg_test_home/private-keys-v1.d/FA64ACD7CC871371BDF57285A6CDF0E618827783.key +0 -0
  98. data/test/integration/test_label_service.rb +0 -18
  99. data/test/test_yaml_migration.rb +0 -85
@@ -0,0 +1,80 @@
1
+ Return-Path: <bounce+67613+84234+3618174+8024896@lists.openembedded.org>
2
+ Delivered-To: unknown
3
+ Received: (qmail 702 invoked from network); 7 May 2020 06:15:54 -0000
4
+ Received: from web01.groups.io (HELO web01.groups.io) (66.175.222.12) by
5
+ server-33.tower-414.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384
6
+ encrypted SMTP; 7 May 2020 06:15:54 -0000
7
+ From: "Yu, Mingli" <mingli.yu@windriver.com>
8
+ To: <openembedded-devel@lists.openembedded.org>
9
+ Subject:
10
+ [oe] [meta-python][PATCH] python3-ntplib: add missing python3-io RDEPENDS
11
+ Date: Thu, 7 May 2020 14:15:26 +0800
12
+ Message-ID: <1588832126-393701-1-git-send-email-mingli.yu@windriver.com>
13
+ Precedence: Bulk
14
+ List-Unsubscribe: <https://lists.openembedded.org/g/openembedded-devel/unsub>
15
+ Sender: <openembedded-devel@lists.openembedded.org>
16
+ List-Id: <openembedded-devel.lists.openembedded.org>
17
+ Mailing-List: list openembedded-devel@lists.openembedded.org; contact
18
+ openembedded-devel+owner@lists.openembedded.org
19
+ Delivered-To: mailing list openembedded-devel@lists.openembedded.org
20
+ Reply-To: <openembedded-devel@lists.openembedded.org>
21
+ Content-Type: multipart/mixed; boundary="YleAvGBsp4tLsYxU5fi4"
22
+ MIME-Version: 1.0
23
+
24
+ --YleAvGBsp4tLsYxU5fi4
25
+ Content-Type: text/plain; charset="utf-8"
26
+ Content-Transfer-Encoding: 7bit
27
+ MIME-Version: 1.0
28
+
29
+ From: Mingli Yu <mingli.yu@windriver.com>
30
+
31
+ Add the missing python3-io RDEPENDS to fix
32
+ below error:
33
+ # python3
34
+ Python 3.8.2 (default, Apr 27 2020, 08:51:00)
35
+ [GCC 9.3.0] on linux
36
+ Type "help", "copyright", "credits" or "license" for more information.
37
+ >>> import ntplib
38
+ Traceback (most recent call last):
39
+ File "<stdin>", line 1, in <module>
40
+ File "/usr/lib64/python3.8/site-packages/ntplib.py", line 32, in <module>
41
+ import socket
42
+ ModuleNotFoundError: No module named 'socket'
43
+
44
+ Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
45
+ ---
46
+ meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb | 2 +-
47
+ 1 file changed, 1 insertion(+), 1 deletion(-)
48
+
49
+ diff --git a/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb b/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
50
+ index 93df83a..ce2618b 100644
51
+ --- a/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
52
+ +++ b/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
53
+ @@ -11,4 +11,4 @@ S = "${WORKDIR}/${SRCNAME}-${PV}"
54
+
55
+ inherit setuptools3 python3native pypi
56
+
57
+ -RDEPENDS_${PN} += "${PYTHON_PN}-datetime"
58
+ +RDEPENDS_${PN} += "${PYTHON_PN}-datetime ${PYTHON_PN}-io"
59
+ --
60
+ 2.7.4
61
+
62
+
63
+ --YleAvGBsp4tLsYxU5fi4
64
+ Content-Type: text/plain; charset="utf-8"
65
+ Content-Transfer-Encoding: quoted-printable
66
+ Content-Disposition: inline
67
+
68
+ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
69
+ Links: You receive all messages sent to this group.
70
+
71
+ View/Reply Online (#84234): https://lists.openembedded.org/g/openembedded-d=
72
+ evel/message/84234
73
+ Mute This Topic: https://lists.openembedded.org/mt/74045486/3618174
74
+ Group Owner: openembedded-devel+owner@lists.openembedded.org
75
+ Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/leave/8024=
76
+ 896/1667129725/xyzzy [dan.callaghan@opengear.com]
77
+ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
78
+
79
+ --YleAvGBsp4tLsYxU5fi4--
80
+
@@ -0,0 +1,36 @@
1
+ Return-Path: <spammer@example.com>
2
+ From: SPAM � <spammer@example.com>
3
+ To: <recipient@example.invalid>
4
+ Subject: spam � spam
5
+ MIME-Version: 1.0
6
+ Content-Type: multipart/mixed; boundary="----------=_4F506AC2.EE281DC4"
7
+ Message-Id: <20120302063755.0FE2122017@a.a.a.a>
8
+ Date: Fri, 2 Mar 2012 07:37:55 +0100 (CET)
9
+
10
+ This is a multi-part message in MIME format.
11
+
12
+ ------------=_4F506AC2.EE281DC4
13
+ Content-Type: text/plain; charset=iso-8859-1
14
+ Content-Disposition: inline
15
+ Content-Transfer-Encoding: 8bit
16
+
17
+ Spam detection software, running on the system "a.a.a.a.a.", has
18
+ identified this incoming email as possible spam. The original message
19
+ has been attached to this so you can view it (if it isn't spam) or label
20
+ similar future email.
21
+
22
+
23
+ ------------=_4F506AC2.EE281DC4
24
+ Content-Type: message/rfc822; x-spam-type=original
25
+ Content-Description: original message before SpamAssassin
26
+ Content-Disposition: attachment
27
+ Content-Transfer-Encoding: 8bit
28
+
29
+ From: SPAM � <spammer@example.com>
30
+ To: <enclosed@example.invalid>
31
+ Subject: spam � spam
32
+
33
+ This is a spam.
34
+
35
+ ------------=_4F506AC2.EE281DC4--
36
+
@@ -0,0 +1,8 @@
1
+ Return-Path: <spammer@example.com>
2
+ From: SPAM � <spammer@example.com>
3
+ To: <a@b.c>
4
+ Subject: spam � spam
5
+ Message-Id: <20120302063755.0FE2122017@a.a.a.a>
6
+ Date: Fri, 2 Mar 2012 07:37:55 +0100 (CET)
7
+
8
+ https://github.com/sup-heliotrope/sup/issues/205
@@ -0,0 +1,15 @@
1
+ From: test@example.invalid
2
+ To: test@example.invalid
3
+ Date: Sun, 19 Jul 2020 17:03:56 +1000
4
+ Subject:
5
+ =?US-ASCII?q?Hans Martin Djupvik?= =?ISO-8859-1?q?,_Ingrid_B=F8?=
6
+ =?KOI8-R?b?LCDp0snOwSDzycTP0s/XwQ?=
7
+ =?UTF-16?b?//4sACAASgBlAHMAcABlAHIAIABCAGUAcgBnAA?=
8
+ =?UTF-7?b?LCBGcmlkYSBFbmcrQVBnLQ?=
9
+ bad: =?UTF16?q?badcharsetname?= =?US-ASCII?b?/w?=
10
+ =?UTF-7?Q?=41=6D=65=72=69=63=61=E2=80=99=73?=
11
+
12
+ The subject header contains various RFC2047 encoded words.
13
+ For completeness we test both base64 and quoted-printable, and some
14
+ ASCII-incompatible encodings.
15
+ We also include some bogus words which cannot be decoded.
@@ -0,0 +1,60 @@
1
+ From: Fake Sender <fake_sender@example.invalid>
2
+ To: Fake Receiver <fake_receiver@localhost>
3
+ Date: Sun, 21 Jun 2020 06:25:49 -0000
4
+ Subject: Attachments with charset
5
+ MIME-Version: 1.0
6
+ Content-Type: multipart/mixed; boundary="===============2385509127900810307=="
7
+
8
+ --===============2385509127900810307==
9
+ Content-Type: text/plain; charset="utf-8"
10
+ Content-Transfer-Encoding: 7bit
11
+
12
+ This is the body.
13
+
14
+ --===============2385509127900810307==
15
+ Content-Type: text/plain; charset="us-ascii"
16
+ Content-Transfer-Encoding: 7bit
17
+ MIME-Version: 1.0
18
+ Content-Disposition: attachment; filename="ascii.txt"
19
+
20
+ This is ASCII
21
+
22
+ --===============2385509127900810307==
23
+ Content-Type: text/plain; charset="koi8-r"
24
+ Content-Transfer-Encoding: quoted-printable
25
+ MIME-Version: 1.0
26
+ Content-Disposition: attachment; filename="cyrillic.txt"
27
+
28
+ =F0=D2=C9=D7=C5=D4
29
+
30
+ --===============2385509127900810307==
31
+ Content-Type: text/plain; charset="utf-8"
32
+ Content-Transfer-Encoding: base64
33
+ MIME-Version: 1.0
34
+ Content-Disposition: attachment; filename="emoji.txt"
35
+
36
+ 8J+Yggo=
37
+
38
+ --===============2385509127900810307==
39
+ Content-Type: text/plain
40
+ Content-Transfer-Encoding: quoted-printable
41
+ Content-Disposition: attachment; filename="bad.txt"
42
+ MIME-Version: 1.0
43
+
44
+ Embedded=F0garbage
45
+
46
+ --===============2385509127900810307==
47
+ Content-Type: text/plain; charset="invalid-test"; name="invalid-charset.txt"
48
+ Content-Transfer-Encoding: quoted-printable
49
+ Content-Disposition: attachment; filename="invalid-charset.txt"
50
+
51
+ Example invalid charset
52
+ --===============2385509127900810307==
53
+ Content-Type: text/plain; charset="utf-7"
54
+ Content-Transfer-Encoding: 7bit
55
+ MIME-Version: 1.0
56
+ Content-Disposition: attachment; filename="ascii.txt"
57
+
58
+ This is +Jyg-UTF-7+Jyg-
59
+ --===============2385509127900810307==
60
+
@@ -0,0 +1,17 @@
1
+ Delivered-To: djc@djc.id.au
2
+ Received: from orpheus.librarything.com (orpheus.librarything.com [74.201.105.9])
3
+ by djc.id.au (Postfix) with ESMTP id A0CCB20AAB99
4
+ for <djc@djc.id.au>; Sat, 23 Jan 2021 02:52:15 +1000 (AEST)
5
+ Received: by orpheus.librarything.com (Postfix, from userid 0)
6
+ id 21B172C20F9; Fri, 22 Jan 2021 11:52:08 -0500 (EST)
7
+ To: djc@djc.id.au
8
+ Subject: LibraryThing: State of the Thing — January
9
+ MIME-Version: 1.0
10
+ Content-type: text/html; charset=iso-8859-1
11
+ From: tim@librarything.com
12
+ Reply-To: tim@librarything.com
13
+ Message-Id: <20210122165208.21B172C20F9@orpheus.librarything.com>
14
+ Date: Fri, 22 Jan 2021 11:52:08 -0500 (EST)
15
+ Return-Path: <root@orpheus.librarything.com>
16
+
17
+ <p>Some stuff</p>
@@ -0,0 +1,27 @@
1
+ Return-Path: <zimbra.user@example.invalid>
2
+ Delivered-To: <recipient@example.invalid>
3
+ Received: from zmail16.collab.prod.int.phx2.redhat.com (zmail16.collab.prod.int.phx2.redhat.com [10.5.83.18])
4
+ by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3A5xQ06025053
5
+ for <recipient@example.invalid>; Tue, 10 Apr 2012 01:59:26 -0400
6
+ Date: Tue, 10 Apr 2012 01:59:26 -0400 (EDT)
7
+ From: Zimbra User <zimbra.user@example.invalid>
8
+ To: Recipient <recipient@example.invalid>
9
+ Subject: Re: Zimbra
10
+ Message-ID: <0fe105df-e67b-419e-8599-50aaff7260e8@zmail16.collab.prod.int.phx2.redhat.com>
11
+ In-Reply-To: <1334037315-sup-8577@example.invalid>
12
+ Content-Type: text/plain; charset=utf-8
13
+ Content-Transfer-Encoding: 7bit
14
+ MIME-Version: 1.0
15
+ X-Mailer: Zimbra 7.1.2_GA_3268 (ZimbraWebClient - FF3.0 (Linux)/7.1.2_GA_3268)
16
+
17
+ ----- Original Message -----
18
+ > From: "Recipient" <recipient@example.invalid>
19
+ > To: "Zimbra User" <zimbra.user@example.invalid>
20
+ > Sent: Tuesday, April 10, 2012 3:56:15 PM
21
+ > Subject: Re: Zimbra
22
+ >
23
+ > This is the quoted original message.
24
+ >
25
+
26
+
27
+ This is the reply from the Zimbra user.
@@ -1,2 +1,3 @@
1
1
  trust-model always
2
-
2
+ # Set preferred hash algo to the one expected in the test suite
3
+ personal-digest-preferences sha256
Binary file
@@ -1,38 +1,89 @@
1
- #! /bin/bash
1
+ #!/bin/bash
2
2
  #
3
3
  # re-generate test keys for the sup test base
4
4
  #
5
5
  # https://github.com/sup-heliotrope/sup/wiki/Development%3A-Crypto
6
+ #
7
+ # Requires GPG 2.1+ installed as "gpg2"
8
+ #
9
+ # GPG 2.1+ by default uses pubring.kbx - but this isn't backwards compatible
10
+ # with GPG 1 or GPG 2.0.
11
+ # Workaround:
12
+ # - Create empty pubring.gpg file, which causes GPG 2.1+ to use this
13
+ # backwards-compatible store.
14
+ # - Manually export private key copy to secring.gpg, which would be used
15
+ # by GPG 1.
16
+
17
+ set -e -u -o pipefail
6
18
 
7
19
  pushd $(dirname $0)
8
20
 
9
- export GNUPGHOME="$(pwd)"
21
+ echo "Generating keys in: $(pwd)..."
10
22
 
11
- echo "genrating keys in: $GNUPGHOME.."
23
+ echo "Checking gpg2 version"
24
+ gpg2 --version | head -1
12
25
 
13
- rm *.gpg *.asc
26
+ echo "Deleting all existing test keys"
27
+ rm -f \
28
+ *.gpg \
29
+ *.asc \
30
+ private-keys-v1.d/*.key \
31
+ .gpg-v21-migrated
14
32
 
15
- echo "generate receiver key.."
16
- gpg --batch --gen-key key2.gen
33
+ echo "Generating key pair for test receiver (email sup-test-2@foo.bar.asc)"
34
+ touch pubring.gpg # So GPG 2.1+ writes to pubring.gpg instead of pubring.kbx
35
+ gpg2 \
36
+ --homedir . \
37
+ --batch \
38
+ --pinentry-mode loopback \
39
+ --passphrase '' \
40
+ --quick-generate-key sup-test-2@foo.bar rsa encrypt,sign 0
17
41
 
18
- echo "export receiver key.."
42
+ echo "Exporting public key only for test receiver (file sup-test-2@foo.bar.asc)"
43
+ gpg2 \
44
+ --homedir . \
45
+ --armor \
46
+ --output sup-test-2@foo.bar.asc \
47
+ --export sup-test-2@foo.bar
19
48
 
20
- gpg --output sup-test-2@foo.bar.asc --armor --export sup-test-2@foo.bar
49
+ echo "Backing up secret key for test receiver (file receiver_secring.gpg)"
50
+ gpg2 \
51
+ --homedir . \
52
+ --export-secret-keys \
53
+ >receiver_secring.gpg
21
54
 
22
- mv trustdb.gpg receiver_trustdb.gpg
23
- mv secring.gpg receiver_secring.gpg
24
- mv pubring.gpg receiver_pubring.gpg
55
+ echo "Backing up pubring.gpg for test receiver (file receiver_pubring.gpg)"
56
+ cp -a pubring.gpg receiver_pubring.gpg
25
57
 
26
- echo "generate sender key.."
27
- gpg --batch --gen-key key1.gen
58
+ echo "Clearing key store, so we can start from a blank slate for next key(s)"
59
+ rm -f pubring.gpg trustdb.gpg private-keys-v1.d/*.key .gpg-v21-migrated
28
60
 
29
- echo "generate ecc key.."
30
- gpg --batch --gen-key key_ecc.gen
61
+ echo "Generating key pair for sender (email sup-test-1@foo.bar)"
62
+ touch pubring.gpg # So GPG 2.1+ writes to pubring.gpg instead of pubring.kbx
63
+ gpg2 \
64
+ --homedir . \
65
+ --batch \
66
+ --pinentry-mode loopback \
67
+ --passphrase '' \
68
+ --quick-generate-key sup-test-1@foo.bar rsa encrypt,sign 0
31
69
 
32
- echo "import receiver key.."
33
- gpg --import sup-test-2@foo.bar.asc
70
+ echo "Importing public key for receiver, into sender's key store"
71
+ gpg2 \
72
+ --homedir . \
73
+ --import sup-test-2@foo.bar.asc
34
74
 
75
+ echo "Copy private key also to secring.gpg (old format used by GPG 1)"
76
+ gpg2 \
77
+ --homedir . \
78
+ --export-secret-keys \
79
+ >secring.gpg
35
80
 
81
+ echo "Done."
36
82
 
37
- popd
83
+ echo "We now have two non-expiring public keys (receiver & sender):"
84
+ gpg2 --homedir . --list-keys
38
85
 
86
+ echo "And we also have only *one* corresponding private key (sender only):"
87
+ gpg2 --homedir . --list-secret-keys
88
+
89
+ popd
Binary file
@@ -1,25 +1,23 @@
1
1
  -----BEGIN PGP PUBLIC KEY BLOCK-----
2
- Version: GnuPG v2
3
2
 
4
- mQGiBFP3VogRBADVBEkaZQXj728C1HUIaTRDCFoKzojwC79Z1BLsD72qQYE8z1ic
5
- 5P9CJpJU5wbhQFDTGBjw+i1nNTWy01z4q5bfFqok+KorT3XNp5IJRcRIEOkj+Twq
6
- 7ZaSOD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xNE3SRQuy2ApYJxKPZIj1KpUL8M
17
+ 7Jy/2hI8DaRm/0Fpu8HwRIVsd6/dgdkqdj1uVyLj+wyhgdzqV5WrPLFCRVhd3icd
18
+ lPNRIDjg8YKCh353LVHjKwefOW4SnkOPn4uVMdCP9gUFd9zpMP9lMFpjk0o0tcYO
19
+ NiFrOclS4q5qZ5jrj1MnBF0NaGhuC83DDgRfKV+p5noVeJxg0nXYZSlsSMfAT/K7
20
+ FbdNEg0XUsrLgWVzhvWv/ebMetFPSfGHIveZ7lhiq1qpA5hLBNfSSBb1JJsFmtQt
21
+ cEUluymdNe5W7Y6UGs1CpvcIvbj+
22
+ =Cy9S
25
23
  -----END PGP PUBLIC KEY BLOCK-----
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class TestMbox < MiniTest::Test
3
+ class TestMbox < Minitest::Test
4
4
 
5
5
  def setup
6
6
  @path = Dir.mktmpdir
@@ -0,0 +1,83 @@
1
+ class TestSupAdd < Minitest::Test
2
+
3
+ def setup
4
+ @path = Dir.mktmpdir
5
+ end
6
+
7
+ def teardown
8
+ FileUtils.rm_r @path
9
+ end
10
+
11
+ def test_can_add_maildir_source
12
+ _out, _err = capture_subprocess_io do
13
+ assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:///some/path")
14
+ end
15
+
16
+ generated_sources_yaml = File.read "#{@path}/sources.yaml"
17
+ assert_equal <<EOS, generated_sources_yaml
18
+ ---
19
+ - !<tag:supmua.org,2006-10-01/Redwood/Maildir>
20
+ uri: maildir:///some/path
21
+ usual: true
22
+ archived: false
23
+ sync_back: true
24
+ id: 1
25
+ labels: []
26
+ EOS
27
+ end
28
+
29
+ def test_fixes_old_tag_uri_syntax
30
+ File.write "#{@path}/sources.yaml", <<EOS
31
+ ---
32
+ - !supmua.org,2006-10-01/Redwood/Maildir
33
+ uri: maildir:/some/path
34
+ usual: true
35
+ archived: false
36
+ sync_back: true
37
+ id: 1
38
+ labels: []
39
+ EOS
40
+ _out, _err = capture_subprocess_io do
41
+ assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:///other/path")
42
+ end
43
+
44
+ generated_sources_yaml = File.read "#{@path}/sources.yaml"
45
+ assert_equal <<EOS, generated_sources_yaml
46
+ ---
47
+ - !<tag:supmua.org,2006-10-01/Redwood/Maildir>
48
+ uri: maildir:/some/path
49
+ usual: true
50
+ archived: false
51
+ sync_back: true
52
+ id: 1
53
+ labels: []
54
+ - !<tag:supmua.org,2006-10-01/Redwood/Maildir>
55
+ uri: maildir:///other/path
56
+ usual: true
57
+ archived: false
58
+ sync_back: true
59
+ id: 2
60
+ labels: []
61
+ EOS
62
+ end
63
+
64
+ ## https://github.com/sup-heliotrope/sup/issues/545
65
+ def test_source_with_invalid_uri_chars_in_path
66
+ _out, _err = capture_subprocess_io do
67
+ assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:~/.mail/gmail/[Gmail]/.All Mail/")
68
+ end
69
+
70
+ generated_sources_yaml = File.read "#{@path}/sources.yaml"
71
+ assert_equal <<EOS, generated_sources_yaml
72
+ ---
73
+ - !<tag:supmua.org,2006-10-01/Redwood/Maildir>
74
+ uri: maildir:~/.mail/gmail/[Gmail]/.All Mail/
75
+ usual: true
76
+ archived: false
77
+ sync_back: true
78
+ id: 1
79
+ labels: []
80
+ EOS
81
+ end
82
+
83
+ end
data/test/test_crypto.rb CHANGED
@@ -61,12 +61,32 @@ class TestCryptoManager < Minitest::Test
61
61
  if CryptoManager.have_crypto? then
62
62
  signed = CryptoManager.sign @from_email,@to_email,"ABCDEFG"
63
63
  assert_instance_of RMail::Message, signed
64
+ assert_equal("multipart/signed; protocol=application/pgp-signature; micalg=pgp-sha256",
65
+ signed.header["Content-Type"])
64
66
  assert_equal "ABCDEFG", signed.body[0]
65
67
  assert signed.body[1].body.length > 0 , "signature length must be > 0"
66
68
  assert (signed.body[1].body.include? "-----BEGIN PGP SIGNATURE-----") , "Expecting PGP armored data"
67
69
  end
68
70
  end
69
71
 
72
+ def test_sign_nested_parts
73
+ if CryptoManager.have_crypto? then
74
+ body = RMail::Message.new
75
+ body.header["Content-Disposition"] = "inline"
76
+ body.body = "ABCDEFG"
77
+ payload = RMail::Message.new
78
+ payload.header["MIME-Version"] = "1.0"
79
+ payload.add_part body
80
+ payload.add_part RMail::Message.make_attachment "attachment", "text/plain", nil, "attachment.txt"
81
+ signed = CryptoManager.sign @from_email, @to_email, payload
82
+ ## The result is a multipart/signed containing a multipart/mixed.
83
+ ## There should be a MIME-Version header on the top-level
84
+ ## multipart/signed message, but *not* on the enclosed
85
+ ## multipart/mixed part.
86
+ assert_equal 1, signed.to_s.scan(/MIME-Version:/).size
87
+ end
88
+ end
89
+
70
90
  def test_encrypt
71
91
  if CryptoManager.have_crypto? then
72
92
  encrypted = CryptoManager.encrypt @from_email, [@to_email], "ABCDEFG"
@@ -114,6 +134,32 @@ class TestCryptoManager < Minitest::Test
114
134
  CryptoManager.verify signed.body[0], signed.body[1], true
115
135
  end
116
136
  end
137
+
138
+ def test_verify_nested_parts
139
+ if CryptoManager.have_crypto?
140
+ ## Generate a multipart/signed containing a multipart/mixed.
141
+ ## We will test verifying the generated signature below.
142
+ ## Importantly, the inner multipart/mixed does *not* have a
143
+ ## MIME-Version header because it is not a top-level message.
144
+ payload = RMail::Parser.read <<EOS
145
+ Content-Type: multipart/mixed; boundary="=-1652088224-7794-561531-1825-1-="
146
+
147
+
148
+ --=-1652088224-7794-561531-1825-1-=
149
+ Content-Disposition: inline
150
+
151
+ ABCDEFG
152
+ --=-1652088224-7794-561531-1825-1-=
153
+ Content-Disposition: attachment; filename="attachment.txt"
154
+ Content-Type: text/plain; name="attachment.txt"
155
+
156
+ attachment
157
+ --=-1652088224-7794-561531-1825-1-=--
158
+ EOS
159
+ signed = CryptoManager.sign @from_email_ecc, @to_email, payload
160
+ CryptoManager.verify payload, signed.body[1], true
161
+ end
162
+ end
117
163
  end
118
164
 
119
165
  end
@@ -11,9 +11,15 @@ class TestMBoxParsing < Minitest::Test
11
11
  def setup
12
12
  @path = Dir.mktmpdir
13
13
  @mbox = File.join(@path, 'test_mbox')
14
+ @log = StringIO.new
15
+ Redwood::Logger.add_sink @log
16
+ Redwood::Logger.remove_sink $stderr
14
17
  end
15
18
 
16
19
  def teardown
20
+ Redwood::Logger.clear!
21
+ Redwood::Logger.remove_sink @log
22
+ Redwood::Logger.add_sink $stderr
17
23
  FileUtils.rm_r @path
18
24
  end
19
25
 
@@ -69,7 +75,7 @@ EOS
69
75
 
70
76
  def test_blank_lines
71
77
  h = Source.parse_raw_email_header StringIO.new("")
72
- assert_equal nil, h["message-id"]
78
+ assert_nil h["message-id"]
73
79
  end
74
80
 
75
81
  def test_empty_headers
@@ -133,6 +139,8 @@ EOS
133
139
  assert_equal 61, offset
134
140
  offset = l.next_offset 61
135
141
  assert_nil offset
142
+ assert_match(/WARNING: found invalid date in potential mbox split line, not splitting/,
143
+ @log.string)
136
144
  end
137
145
 
138
146
  def test_more_from_line_splitting
data/test/test_helper.rb CHANGED
@@ -2,9 +2,12 @@ require "rubygems" rescue nil
2
2
  require 'minitest/autorun'
3
3
  require "rr"
4
4
 
5
- def fixture(filename)
5
+ def fixture_path(filename)
6
+ File.expand_path("../fixtures/#{filename}", __FILE__)
7
+ end
8
+
9
+ def fixture_contents(filename)
6
10
  file = ''
7
- path = File.expand_path("../fixtures/#{filename}", __FILE__)
8
- File.open(path) { |io| file = io.read }
11
+ File.open(fixture_path(filename)) { |io| file = io.read }
9
12
  file
10
- end
13
+ end