[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#958053: buster-pu: package schleuder/3.4.0-2+deb10u3



Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian.org@packages.debian.org
Usertags: pu

Dear SRMs,

Schleuder in buster is affected by various problems, which I would like
to fix:

  - Unfortunately, the encoding fix introduced in the previous version,
    3.4.0-2+deb10u2, had shortcomings if dealing with unencrypted, but
    signed UTF-8 mails or mail parts without a charset. The parsing
    failed and lead to further errors. This problem was discussed
    upstream and with downstreams, providers running Schleuder: the new
    approach switches the default external encoding to UTF-8 and tries
    to convert all non-UTF-8 mails. In case this fails, the invalid
    characters are dropped and a note is added to the mail that this
    happened. To aid in encoding detection, a new dependency is added,
    ruby-charlock-holmes.
    
    While I admit that this change seems invasive for a Debian stable
    update, this approach received extensive testing in production for
    the last three weeks, with promising results. It handled all the
    former problematic mails in a graceful manner. In fact, up until
    now, we weren't able to produce mails which would lead to dropped
    invalid characters as described above. Personally, I would be
    grateful if this would get accepted, as I believe that's the right
    thing to do; it'll lead to more happy users.

    For details, see the following upstream commits: [1] [2] [3]

    This got fixed in unstable via 3.5.0-1. (Closes: #948982)

  - Let x-add-key handle mails with attached, quoted-printable encoded
    keys. Such mails might be produced by Thunderbird. Before, such
    mails were not recognized and Schleuder yielded 'no key could be
    found'.
    
    This got fixed in unstable via 3.5.1-1. (Closes: #956827)

  - Fix x-attach-listkey with mails created by Thunderbird that include
    protected headers. Before, the output was garbled and unusable.
    
    This got fixed in unstable via 3.5.0-1. (Closes: #956964)

The diff is increased as different patches partially target the same
(spec) files. However, most of it comes down to updated timestamps or
fuzz introduced by these new patches in already existing ones. I'll
improve my tooling to reduce the diff size in the future.

Please find the debdiff between schleuder/3.4.0-2+deb10u2 and
schleuder/3.4.0-2+deb10u3 attached.

Thanks for your work!

Cheers,
Georg


[1] https://0xacab.org/schleuder/schleuder/-/commit/39ca2227fb6e7da03bf26f4f36ea157ce3b62bed
[2] https://0xacab.org/schleuder/schleuder/-/commit/275d778b7f27b6625c17adb2a63df91e856c50be
[3] https://0xacab.org/schleuder/schleuder/-/commit/badad300d0784f88d7602dab89e8c9ad166f4e32
diff -Nru schleuder-3.4.0/debian/changelog schleuder-3.4.0/debian/changelog
--- schleuder-3.4.0/debian/changelog	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/changelog	2020-04-17 20:17:07.000000000 +0000
@@ -1,3 +1,28 @@
+schleuder (3.4.0-2+deb10u3) buster; urgency=medium
+
+  * debian/control:
+    - (Build)-Depend on ruby-charlock-holmes to aid in encoding detection.
+  * debian/patches:
+    - Improve patch to handle encoding errors introduced in the previous
+      version, 3.4.0-2+deb10u2. The former approach had shortcomings if
+      parsing unencrypted, but signed UTF-8 mails or mail parts without a
+      charset. The parsing failed and lead to further errors.
+      The new approach switches to UTF-8 as the default input, and tries to
+      convert non-UTF-8 mails. In case this fails, the invalid characters are
+      dropped and a note is added to the mail that this happened.
+      To aid in encoding detection, a new dependency is added,
+      ruby-charlock-holmes.
+      (Closes: #948982)
+    - Add patch to let x-add-key handle mails with attached, quoted-printable
+      encoded keys. Such mails might be produced by Thunderbird. Before, such
+      mails were not recognized.
+      (Closes: #956827)
+    - Add patch to fix x-attach-listkey with mails created by Thunderbird that
+      include protected headers. Before, the output was garbled and unusable.
+      (Closes: #956964)
+
+ -- Georg Faerber <georg@debian.org>  Fri, 17 Apr 2020 20:17:07 +0000
+
 schleuder (3.4.0-2+deb10u2) buster; urgency=medium
 
   * debian/patches:
diff -Nru schleuder-3.4.0/debian/control schleuder-3.4.0/debian/control
--- schleuder-3.4.0/debian/control	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/control	2020-04-17 20:17:07.000000000 +0000
@@ -9,6 +9,7 @@
                procps,
                rake (>= 10.5.0~),
                ruby-activerecord (>= 5.2~),
+               ruby-charlock-holmes,
                ruby-database-cleaner (>= 1.7.0~),
                ruby-factory-bot,
                ruby-gpgme (>= 2.0.13~),
@@ -39,6 +40,7 @@
          rake (>= 10.5.0~),
          ruby | ruby-interpreter,
          ruby-activerecord (>= 5.2~),
+         ruby-charlock-holmes,
          ruby-gpgme (>= 2.0.13~),
          ruby-mail (>= 2.7.1~),
          ruby-mail-gpg (>= 0.3.3~),
diff -Nru schleuder-3.4.0/debian/patches/0001-lib-fix-paths.patch schleuder-3.4.0/debian/patches/0001-lib-fix-paths.patch
--- schleuder-3.4.0/debian/patches/0001-lib-fix-paths.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0001-lib-fix-paths.patch	2020-04-17 20:17:07.000000000 +0000
@@ -14,8 +14,10 @@
 Last-Update: 2018-09-21
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/lib/schleuder/conf.rb
-+++ b/lib/schleuder/conf.rb
+Index: schleuder/lib/schleuder/conf.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/conf.rb	2020-04-17 09:28:12.946491925 +0000
++++ schleuder/lib/schleuder/conf.rb	2020-04-17 09:28:12.942491877 +0000
 @@ -10,7 +10,7 @@
  
      DEFAULTS = {
@@ -25,9 +27,11 @@
        'plugins_dir' => '/etc/schleuder/plugins',
        'filters_dir' => '/usr/local/lib/schleuder/filters',
        'log_level' => 'warn',
---- a/lib/schleuder/cli.rb
-+++ b/lib/schleuder/cli.rb
-@@ -79,7 +79,7 @@
+Index: schleuder/lib/schleuder/cli.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/cli.rb	2020-04-17 09:28:12.946491925 +0000
++++ schleuder/lib/schleuder/cli.rb	2020-04-17 09:28:12.942491877 +0000
+@@ -81,7 +81,7 @@
      desc 'install', "Set-up or update Schleuder environment (create folders, copy files, fill the database)."
      def install
        config_dir = Pathname.new(ENV['SCHLEUDER_CONFIG']).dirname
@@ -36,9 +40,11 @@
  
        # Check if lists_dir contains v2-data.
        if Dir.glob("#{Conf.lists_dir}/*/*/members.conf").size > 0
---- a/lib/schleuder.rb
-+++ b/lib/schleuder.rb
-@@ -74,6 +74,7 @@
+Index: schleuder/lib/schleuder.rb
+===================================================================
+--- schleuder.orig/lib/schleuder.rb	2020-04-17 09:28:12.946491925 +0000
++++ schleuder/lib/schleuder.rb	2020-04-17 09:28:12.942491877 +0000
+@@ -84,6 +84,7 @@
  end
  
  I18n.load_path += Dir["#{rootdir}/locales/*.yml"]
diff -Nru schleuder-3.4.0/debian/patches/0007-specs-remove-install-test.patch schleuder-3.4.0/debian/patches/0007-specs-remove-install-test.patch
--- schleuder-3.4.0/debian/patches/0007-specs-remove-install-test.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0007-specs-remove-install-test.patch	2020-04-17 20:17:07.000000000 +0000
@@ -8,9 +8,11 @@
 Last-Update: 2018-09-21
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/spec/schleuder/integration/cli_spec.rb
-+++ b/spec/schleuder/integration/cli_spec.rb
-@@ -293,35 +293,6 @@
+Index: schleuder/spec/schleuder/integration/cli_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:28:01.686358411 +0000
++++ schleuder/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:28:01.682358364 +0000
+@@ -290,35 +290,6 @@
      end
    end
  
diff -Nru schleuder-3.4.0/debian/patches/0008-dirmngr-no-tor-standard-resolver.patch schleuder-3.4.0/debian/patches/0008-dirmngr-no-tor-standard-resolver.patch
--- schleuder-3.4.0/debian/patches/0008-dirmngr-no-tor-standard-resolver.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0008-dirmngr-no-tor-standard-resolver.patch	2020-04-17 20:17:07.000000000 +0000
@@ -13,8 +13,10 @@
 Last-Update: 2018-09-21
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/spec/schleuder/integration/cli_spec.rb
-+++ b/spec/schleuder/integration/cli_spec.rb
+Index: schleuder/spec/schleuder/integration/cli_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:27:52.986255208 +0000
++++ schleuder/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:27:52.978255113 +0000
 @@ -154,6 +154,9 @@
        list.import_key(File.read("spec/fixtures/expired_key.txt"))
        list.import_key(File.read("spec/fixtures/olduid_key.txt"))
@@ -25,7 +27,7 @@
        with_sks_mock do
          Cli.new.refresh_keys
          dirmngr_pid = `pgrep -a dirmngr | grep #{list.listdir}`.split(' ',2).first
-@@ -178,6 +181,9 @@
+@@ -177,6 +180,9 @@
          list.import_key(File.read("spec/fixtures/olduid_key.txt"))
        end
  
@@ -35,9 +37,11 @@
        with_sks_mock do
          Cli.new.refresh_keys list1.email
        end
---- a/spec/schleuder/integration/keywords_spec.rb
-+++ b/spec/schleuder/integration/keywords_spec.rb
-@@ -1421,6 +1421,9 @@
+Index: schleuder/spec/schleuder/integration/keywords_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:27:52.986255208 +0000
++++ schleuder/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:27:52.982255160 +0000
+@@ -1463,6 +1463,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -47,7 +51,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1457,6 +1460,9 @@
+@@ -1499,6 +1502,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -57,7 +61,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1493,6 +1499,9 @@
+@@ -1535,6 +1541,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -67,7 +71,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1530,6 +1539,9 @@
+@@ -1572,6 +1581,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -77,7 +81,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1566,6 +1578,9 @@
+@@ -1608,6 +1620,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -87,7 +91,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1602,6 +1617,9 @@
+@@ -1644,6 +1659,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -97,7 +101,7 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
-@@ -1638,6 +1656,9 @@
+@@ -1680,6 +1698,9 @@
      encrypted_mail = Mail::TestMailer.deliveries.first
      Mail::TestMailer.deliveries.clear
  
@@ -107,8 +111,10 @@
      with_sks_mock do
        begin
          Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
---- a/spec/schleuder/unit/gpgme_ctx.rb
-+++ b/spec/schleuder/unit/gpgme_ctx.rb
+Index: schleuder/spec/schleuder/unit/gpgme_ctx.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/unit/gpgme_ctx.rb	2020-04-17 09:27:52.986255208 +0000
++++ schleuder/spec/schleuder/unit/gpgme_ctx.rb	2020-04-17 09:27:52.982255160 +0000
 @@ -198,6 +198,9 @@
        list.import_key(File.read("spec/fixtures/expired_key.txt"))
        list.import_key(File.read("spec/fixtures/olduid_key.txt"))
@@ -119,8 +125,10 @@
        res = ''
        with_sks_mock do
          res = list.gpg.refresh_keys(list.keys)
---- a/spec/schleuder/unit/list_spec.rb
-+++ b/spec/schleuder/unit/list_spec.rb
+Index: schleuder/spec/schleuder/unit/list_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/unit/list_spec.rb	2020-04-17 09:27:52.986255208 +0000
++++ schleuder/spec/schleuder/unit/list_spec.rb	2020-04-17 09:27:52.982255160 +0000
 @@ -489,6 +489,9 @@
        list.subscribe("admin@example.org", nil, true)
        output = ''
diff -Nru schleuder-3.4.0/debian/patches/0016-gemspec-update-sinatra.patch schleuder-3.4.0/debian/patches/0016-gemspec-update-sinatra.patch
--- schleuder-3.4.0/debian/patches/0016-gemspec-update-sinatra.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0016-gemspec-update-sinatra.patch	2020-04-17 20:17:07.000000000 +0000
@@ -5,8 +5,10 @@
 Last-Update: 2019-02-14
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/schleuder.gemspec
-+++ b/schleuder.gemspec
+Index: schleuder/schleuder.gemspec
+===================================================================
+--- schleuder.orig/schleuder.gemspec	2020-04-17 09:27:37.170067488 +0000
++++ schleuder/schleuder.gemspec	2020-04-17 09:27:37.166067440 +0000
 @@ -37,8 +37,8 @@
    s.add_runtime_dependency 'rack-test', '~> 0.7.0'
    s.add_runtime_dependency 'rake', '>= 10.5.0'
@@ -17,4 +19,4 @@
 +  s.add_runtime_dependency 'sinatra-contrib', '~> 2'
    s.add_runtime_dependency 'thor', '~> 0'
    s.add_runtime_dependency 'thin', '~> 1'
-   s.add_development_dependency 'rspec', '~> 3.5.0'
+   s.add_runtime_dependency 'charlock_holmes', '~> 0.7.6'
diff -Nru schleuder-3.4.0/debian/patches/0018-refresh_keys-no-list.patch schleuder-3.4.0/debian/patches/0018-refresh_keys-no-list.patch
--- schleuder-3.4.0/debian/patches/0018-refresh_keys-no-list.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0018-refresh_keys-no-list.patch	2020-04-17 20:17:07.000000000 +0000
@@ -5,9 +5,9 @@
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Index: schleuder/lib/schleuder/cli.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/cli.rb	2019-11-03 20:13:16.127752282 +0000
-+++ schleuder/lib/schleuder/cli.rb	2019-11-03 20:13:16.123752314 +0000
-@@ -320,10 +320,13 @@
+--- schleuder.orig/lib/schleuder/cli.rb	2020-04-17 09:27:32.634013626 +0000
++++ schleuder/lib/schleuder/cli.rb	2020-04-17 09:27:32.630013579 +0000
+@@ -321,10 +321,13 @@
      private
  
      def work_on_lists(subj, list=nil)
diff -Nru schleuder-3.4.0/debian/patches/0019-refresh-fetch-strip-non-self-sigs.patch schleuder-3.4.0/debian/patches/0019-refresh-fetch-strip-non-self-sigs.patch
--- schleuder-3.4.0/debian/patches/0019-refresh-fetch-strip-non-self-sigs.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0019-refresh-fetch-strip-non-self-sigs.patch	2020-04-17 20:17:07.000000000 +0000
@@ -5,9 +5,9 @@
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Index: schleuder/lib/schleuder/cli.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/cli.rb	2019-11-03 19:15:19.000000000 +0000
-+++ schleuder/lib/schleuder/cli.rb	2019-11-03 19:21:53.632021708 +0000
-@@ -67,6 +67,7 @@
+--- schleuder.orig/lib/schleuder/cli.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/lib/schleuder/cli.rb	2020-04-17 09:27:22.049887904 +0000
+@@ -68,6 +68,7 @@
  
      desc 'refresh_keys [list1@example.com]', "Refresh all keys of all list from the keyservers sequentially (one by one or on the passed list). (This is supposed to be run from cron weekly.)"
      def refresh_keys(list=nil)
@@ -15,7 +15,7 @@
        work_on_lists(:refresh_keys,list)
        permission_notice
      end
-@@ -324,6 +325,7 @@
+@@ -325,6 +326,7 @@
        else
          List.where(email: list)
        end
@@ -25,8 +25,8 @@
          output = list.send(subj)
 Index: schleuder/lib/schleuder/gpgme/ctx.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/gpgme/ctx.rb	2019-11-03 18:33:31.852282869 +0000
-+++ schleuder/lib/schleuder/gpgme/ctx.rb	2019-11-03 19:21:53.632021708 +0000
+--- schleuder.orig/lib/schleuder/gpgme/ctx.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/lib/schleuder/gpgme/ctx.rb	2020-04-17 09:27:22.049887904 +0000
 @@ -103,7 +103,7 @@
      end
  
@@ -75,7 +75,7 @@
 Index: schleuder/spec/fixtures/openpgp-keys/public-key-with-third-party-signature.txt
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/openpgp-keys/public-key-with-third-party-signature.txt	2019-11-03 19:21:53.632021708 +0000
++++ schleuder/spec/fixtures/openpgp-keys/public-key-with-third-party-signature.txt	2020-04-17 09:27:22.049887904 +0000
 @@ -0,0 +1,41 @@
 +-----BEGIN PGP PUBLIC KEY BLOCK-----
 +
@@ -120,8 +120,8 @@
 +-----END PGP PUBLIC KEY BLOCK-----
 Index: schleuder/spec/schleuder/integration/cli_spec.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/integration/cli_spec.rb	2019-11-03 18:33:31.852282869 +0000
-+++ schleuder/spec/schleuder/integration/cli_spec.rb	2019-11-03 19:21:53.632021708 +0000
+--- schleuder.orig/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/spec/schleuder/integration/cli_spec.rb	2020-04-17 09:27:22.049887904 +0000
 @@ -159,9 +159,8 @@
          dirmngr_pid = `pgrep -a dirmngr | grep #{list.listdir}`.split(' ',2).first
          expect(dirmngr_pid).to be_nil
@@ -157,9 +157,9 @@
          expect(mail.to_s).to include("keyserver refresh failed: No keyserver available")
 Index: schleuder/spec/schleuder/integration/keywords_spec.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/integration/keywords_spec.rb	2019-11-03 18:33:31.856283673 +0000
-+++ schleuder/spec/schleuder/integration/keywords_spec.rb	2019-11-03 19:21:53.632021708 +0000
-@@ -1427,7 +1427,7 @@
+--- schleuder.orig/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:27:22.053887951 +0000
+@@ -1469,7 +1469,7 @@
        rescue SystemExit
        end
      end
@@ -168,7 +168,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num + 1)
-@@ -1463,7 +1463,7 @@
+@@ -1505,7 +1505,7 @@
        rescue SystemExit
        end
      end
@@ -177,7 +177,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num)
-@@ -1499,7 +1499,7 @@
+@@ -1541,7 +1541,7 @@
        rescue SystemExit
        end
      end
@@ -186,7 +186,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num + 1)
-@@ -1536,7 +1536,7 @@
+@@ -1578,7 +1578,7 @@
        rescue SystemExit
        end
      end
@@ -195,7 +195,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num)
-@@ -1572,7 +1572,7 @@
+@@ -1614,7 +1614,7 @@
        rescue SystemExit
        end
      end
@@ -204,7 +204,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num)
-@@ -1608,7 +1608,7 @@
+@@ -1650,7 +1650,7 @@
        rescue SystemExit
        end
      end
@@ -213,7 +213,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num + 1)
-@@ -1644,7 +1644,7 @@
+@@ -1686,7 +1686,7 @@
        rescue SystemExit
        end
      end
@@ -222,7 +222,7 @@
      message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
  
      expect(list.keys.size).to eql(list_keys_num)
-@@ -1680,7 +1680,7 @@
+@@ -1722,7 +1722,7 @@
        rescue SystemExit
        end
      end
@@ -233,8 +233,8 @@
      expect(list.keys.size).to eql(list_keys_num)
 Index: schleuder/spec/schleuder/unit/gpgme_ctx.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/unit/gpgme_ctx.rb	2019-11-03 18:33:31.856283673 +0000
-+++ schleuder/spec/schleuder/unit/gpgme_ctx.rb	2019-11-03 19:21:53.632021708 +0000
+--- schleuder.orig/spec/schleuder/unit/gpgme_ctx.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/spec/schleuder/unit/gpgme_ctx.rb	2020-04-17 09:27:22.053887951 +0000
 @@ -227,5 +227,31 @@
          expect(mail.to_s).to match(/gpgkeys: .* error .* connect/)
        end
@@ -269,8 +269,8 @@
  end
 Index: schleuder/spec/schleuder/unit/list_spec.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/unit/list_spec.rb	2019-11-03 18:33:31.856283673 +0000
-+++ schleuder/spec/schleuder/unit/list_spec.rb	2019-11-03 19:21:53.632021708 +0000
+--- schleuder.orig/spec/schleuder/unit/list_spec.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/spec/schleuder/unit/list_spec.rb	2020-04-17 09:27:22.053887951 +0000
 @@ -525,6 +525,32 @@
  
        teardown_list_and_mailer(list)
@@ -306,8 +306,8 @@
    describe "send_list_key_to_subscriptions" do
 Index: schleuder/spec/sks-mock.rb
 ===================================================================
---- schleuder.orig/spec/sks-mock.rb	2019-11-03 18:33:31.856283673 +0000
-+++ schleuder/spec/sks-mock.rb	2019-11-03 19:21:53.632021708 +0000
+--- schleuder.orig/spec/sks-mock.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/spec/sks-mock.rb	2020-04-17 09:27:22.053887951 +0000
 @@ -23,6 +23,8 @@
        File.read('spec/fixtures/olduid_key_with_newuid.txt')
      when '0x59C71FB38AEE22E091C78259D06350440F759BD3'
@@ -319,8 +319,8 @@
      end
 Index: schleuder/lib/schleuder/logger_notifications.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/logger_notifications.rb	2019-11-03 18:33:31.852282869 +0000
-+++ schleuder/lib/schleuder/logger_notifications.rb	2019-11-03 19:25:11.711883679 +0000
+--- schleuder.orig/lib/schleuder/logger_notifications.rb	2020-04-17 09:27:22.057887999 +0000
++++ schleuder/lib/schleuder/logger_notifications.rb	2020-04-17 09:27:22.053887951 +0000
 @@ -18,9 +18,14 @@
        notify_admin(string, original_message)
      end
diff -Nru schleuder-3.4.0/debian/patches/0020-admin-notifications-list-id-header.patch schleuder-3.4.0/debian/patches/0020-admin-notifications-list-id-header.patch
--- schleuder-3.4.0/debian/patches/0020-admin-notifications-list-id-header.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0020-admin-notifications-list-id-header.patch	2020-04-17 20:17:07.000000000 +0000
@@ -7,9 +7,9 @@
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Index: schleuder/lib/schleuder/logger_notifications.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/logger_notifications.rb	2020-01-15 14:43:57.209563572 +0000
-+++ schleuder/lib/schleuder/logger_notifications.rb	2020-01-15 15:32:09.448514094 +0000
-@@ -42,6 +42,8 @@
+--- schleuder.orig/lib/schleuder/logger_notifications.rb	2020-04-17 09:27:16.701824354 +0000
++++ schleuder/lib/schleuder/logger_notifications.rb	2020-04-17 09:27:16.697824307 +0000
+@@ -37,6 +37,8 @@
              gpg_opts.merge!(encrypt: true, keys: { address => key.fingerprint })
            end
            mail.gpg gpg_opts
@@ -20,8 +20,8 @@
        end
 Index: schleuder/spec/schleuder/unit/logger_notifications_spec.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/unit/logger_notifications_spec.rb	2019-11-03 18:31:21.013704003 +0000
-+++ schleuder/spec/schleuder/unit/logger_notifications_spec.rb	2020-01-15 15:32:09.448514094 +0000
+--- schleuder.orig/spec/schleuder/unit/logger_notifications_spec.rb	2020-04-17 09:27:16.701824354 +0000
++++ schleuder/spec/schleuder/unit/logger_notifications_spec.rb	2020-04-17 09:27:16.697824307 +0000
 @@ -97,4 +97,16 @@
      expect(message.parts.size).to be(2)
      expect(message.parts.first.parts.first.body.to_s).to eql('Something')
diff -Nru schleuder-3.4.0/debian/patches/0021-handle-decryption-errors-gracefully.patch schleuder-3.4.0/debian/patches/0021-handle-decryption-errors-gracefully.patch
--- schleuder-3.4.0/debian/patches/0021-handle-decryption-errors-gracefully.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0021-handle-decryption-errors-gracefully.patch	2020-04-17 20:17:07.000000000 +0000
@@ -11,9 +11,9 @@
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Index: schleuder/lib/schleuder/runner.rb
 ===================================================================
---- schleuder.orig/lib/schleuder/runner.rb	2020-01-27 10:27:08.055213435 +0000
-+++ schleuder/lib/schleuder/runner.rb	2020-01-27 10:27:08.051213394 +0000
-@@ -13,7 +13,12 @@
+--- schleuder.orig/lib/schleuder/runner.rb	2020-04-17 09:27:03.349665621 +0000
++++ schleuder/lib/schleuder/runner.rb	2020-04-17 09:27:03.341665527 +0000
+@@ -36,7 +36,12 @@
        begin
          # This decrypts, verifies, etc.
          @mail = @mail.setup
@@ -30,7 +30,7 @@
 Index: schleuder/spec/fixtures/mails/containing-pgp-garbage.txt
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/containing-pgp-garbage.txt	2020-01-27 10:27:08.051213394 +0000
++++ schleuder/spec/fixtures/mails/containing-pgp-garbage.txt	2020-04-17 09:27:03.341665527 +0000
 @@ -0,0 +1,28 @@
 +Date: Sat, 4 Jan 2020 23:42:49 +0000
 +From: <schleuder@example.org>
@@ -63,7 +63,7 @@
 Index: schleuder/spec/fixtures/mails/encrypted-to-absent-key.txt
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/encrypted-to-absent-key.txt	2020-01-27 10:27:08.051213394 +0000
++++ schleuder/spec/fixtures/mails/encrypted-to-absent-key.txt	2020-04-17 09:27:03.341665527 +0000
 @@ -0,0 +1,38 @@
 +Date: Sat, 4 Jan 2020 23:42:49 +0000
 +From: <schleuder@example.org>
@@ -106,7 +106,7 @@
 Index: schleuder/spec/fixtures/mails/encrypted-to-passphrase.txt
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/encrypted-to-passphrase.txt	2020-01-27 10:27:08.051213394 +0000
++++ schleuder/spec/fixtures/mails/encrypted-to-passphrase.txt	2020-04-17 09:27:03.341665527 +0000
 @@ -0,0 +1,30 @@
 +Date: Sat, 4 Jan 2020 23:42:49 +0000
 +From: <schleuder@example.org>
@@ -140,8 +140,8 @@
 +--eAbsdosE1cNLO4uF--
 Index: schleuder/spec/schleuder/runner_spec.rb
 ===================================================================
---- schleuder.orig/spec/schleuder/runner_spec.rb	2020-01-27 10:27:08.055213435 +0000
-+++ schleuder/spec/schleuder/runner_spec.rb	2020-01-27 10:27:08.051213394 +0000
+--- schleuder.orig/spec/schleuder/runner_spec.rb	2020-04-17 09:27:03.349665621 +0000
++++ schleuder/spec/schleuder/runner_spec.rb	2020-04-17 09:27:03.341665527 +0000
 @@ -182,6 +182,54 @@
        end
      end
@@ -199,8 +199,8 @@
          list.subscribe("admin@example.org", nil, true, false)
 Index: schleuder/lib/schleuder.rb
 ===================================================================
---- schleuder.orig/lib/schleuder.rb	2020-01-27 10:27:08.035213230 +0000
-+++ schleuder/lib/schleuder.rb	2020-01-27 10:28:22.279984298 +0000
+--- schleuder.orig/lib/schleuder.rb	2020-04-17 09:27:03.349665621 +0000
++++ schleuder/lib/schleuder.rb	2020-04-17 09:27:03.345665574 +0000
 @@ -68,6 +68,9 @@
  ENV["SCHLEUDER_LIST_DEFAULTS"] ||= '/etc/schleuder/list-defaults.yml'
  ENV["SCHLEUDER_ENV"] ||= 'production'
diff -Nru schleuder-3.4.0/debian/patches/0022-ASCII-8BIT-encoding.patch schleuder-3.4.0/debian/patches/0022-ASCII-8BIT-encoding.patch
--- schleuder-3.4.0/debian/patches/0022-ASCII-8BIT-encoding.patch	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0022-ASCII-8BIT-encoding.patch	2020-04-17 20:17:07.000000000 +0000
@@ -1,21 +1,26 @@
-Description: Default to ASCII-8BIT encoding
+Description: Default to UTF-8 encoding
   This should ensure Schleuder is able to handle mails with different charsets.
+
+  For details, see the following upstream commits:
+  - https://0xacab.org/schleuder/schleuder/commit/92c7ead414eba3b3787c597b95ff983e32142b56
+  - https://0xacab.org/schleuder/schleuder/-/commit/39ca2227fb6e7da03bf26f4f36ea157ce3b62bed
+  - https://0xacab.org/schleuder/schleuder/-/commit/275d778b7f27b6625c17adb2a63df91e856c50be
+  - https://0xacab.org/schleuder/schleuder/-/commit/badad300d0784f88d7602dab89e8c9ad166f4e32
 Author: ng <ng@immerda.ch>
-Applied-Upstream: https://0xacab.org/schleuder/schleuder/commit/92c7ead414eba3b3787c597b95ff983e32142b56
-Last-Update: 2020-01-15
+Last-Update: 2020-04-17
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Index: schleuder/lib/schleuder.rb
 ===================================================================
---- schleuder.orig/lib/schleuder.rb	2019-11-08 09:30:05.000000000 +0000
-+++ schleuder/lib/schleuder.rb	2020-01-15 16:14:17.431376753 +0000
+--- schleuder.orig/lib/schleuder.rb	2020-04-17 08:28:46.624916806 +0000
++++ schleuder/lib/schleuder.rb	2020-04-17 08:29:26.589385781 +0000
 @@ -1,3 +1,10 @@
-+# default to ASCII-8BIT encoding as early as possible for external
++# default to UTF-8 encoding as early as possible for external
 +# data.
 +#
 +# this should ensure we are able to parse most incoming
 +# plain text mails in different charsets.
-+Encoding.default_external = Encoding::ASCII_8BIT
++Encoding.default_external = Encoding::UTF_8
 +
  # Stdlib
  require 'fileutils'
@@ -23,7 +28,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/japanese.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/japanese.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/japanese.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,9 @@
 +MIME-Version: 1.0
 +Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
@@ -38,7 +43,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/japanese_attachment.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/japanese_attachment.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/japanese_attachment.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,27 @@
 +MIME-Version: 1.0
 +Received: by 10.231.35.72 with HTTP; Fri, 16 Oct 2009 05:39:34 -0700 (PDT)
@@ -71,7 +76,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/japanese_attachment_long_name.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/japanese_attachment_long_name.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/japanese_attachment_long_name.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,44 @@
 +Delivered-To: schleuder@example.org
 +Received: by 10.231.12.67 with SMTP id w3cs164325ibw;
@@ -121,7 +126,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/japanese_iso_2022.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/japanese_iso_2022.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/japanese_iso_2022.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,10 @@
 +MIME-Version: 1.0
 +Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
@@ -136,7 +141,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/japanese_shift_jis.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/japanese_shift_jis.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/japanese_shift_jis.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,15 @@
 +Delivered-To: schleuder@example.org
 +Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
@@ -156,7 +161,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/ks_c_5601-1987.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/ks_c_5601-1987.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/ks_c_5601-1987.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,11 @@
 +Delivered-To: schleuder@example.org
 +Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
@@ -172,7 +177,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/simple_jis.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/simple_jis.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/simple_jis.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,14 @@
 +Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
 +From: sender@example.com
@@ -191,7 +196,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/simple_jpiso2022.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/simple_jpiso2022.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/simple_jpiso2022.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,10 @@
 +MIME-Version: 1.0
 +Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
@@ -206,7 +211,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/simple_latin1.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/simple_latin1.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/simple_latin1.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,10 @@
 +Subject: test
 +To: schleuder@example.org
@@ -221,7 +226,7 @@
 Index: schleuder/spec/fixtures/mails/charset_mails/simple_utf8.eml
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/fixtures/mails/charset_mails/simple_utf8.eml	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/simple_utf8.eml	2020-04-17 08:28:46.616916712 +0000
 @@ -0,0 +1,10 @@
 +Subject: test
 +To: schleuder@example.org
@@ -236,7 +241,7 @@
 Index: schleuder/spec/schleuder/integration/receive_different_charsets_spec.rb
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ schleuder/spec/schleuder/integration/receive_different_charsets_spec.rb	2020-01-15 16:14:17.443376897 +0000
++++ schleuder/spec/schleuder/integration/receive_different_charsets_spec.rb	2020-04-17 08:28:46.620916759 +0000
 @@ -0,0 +1,25 @@
 +require "spec_helper"
 +
@@ -265,8 +270,8 @@
 +
 Index: schleuder/spec/spec_helper.rb
 ===================================================================
---- schleuder.orig/spec/spec_helper.rb	2019-11-03 18:31:21.013704003 +0000
-+++ schleuder/spec/spec_helper.rb	2020-01-15 16:14:17.443376897 +0000
+--- schleuder.orig/spec/spec_helper.rb	2020-04-17 08:28:46.624916806 +0000
++++ schleuder/spec/spec_helper.rb	2020-04-17 08:28:46.620916759 +0000
 @@ -136,6 +136,14 @@
      `SCHLEUDER_ENV=test SCHLEUDER_CONFIG=spec/schleuder.yml bin/schleuder #{command} 2>&1`
    end
@@ -282,3 +287,428 @@
    def process_mail(msg, recipient)
      output = nil
      begin
+Index: schleuder/lib/schleuder/cli.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/cli.rb	2020-04-17 08:24:04.141567850 +0000
++++ schleuder/lib/schleuder/cli.rb	2020-04-17 08:29:53.537701485 +0000
+@@ -1,6 +1,7 @@
+ require 'thor'
+ require 'yaml'
+ require 'gpgme'
++require 'charlock_holmes'
+ 
+ require_relative '../schleuder'
+ require 'schleuder/cli/subcommand_fix'
+Index: schleuder/lib/schleuder/runner.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/runner.rb	2020-04-17 08:24:04.141567850 +0000
++++ schleuder/lib/schleuder/runner.rb	2020-04-17 08:32:42.851676580 +0000
+@@ -5,8 +5,31 @@
+       return error if error
+ 
+       logger.info "Parsing incoming email."
++
++      # is it valid utf-8?
++      msg_scrubbed = false
++      unless msg.valid_encoding?
++        logger.warn "Converting message due to invalid characters"
++        detection = CharlockHolmes::EncodingDetector.detect(msg)
++        begin
++          msg = CharlockHolmes::Converter.convert(msg, detection[:encoding], 'UTF-8')
++        rescue ArgumentError
++          # it looks like even icu wasn't able to convert
++          # so we scrub the invalid characters to be able to
++          # at least parse the message somehow. Though this might
++          # result in data loss.
++          logger.warn "Scrubbing message due to invalid characters"
++          msg = msg.scrub
++          msg_scrubbed = true
++        end
++      end
++
+       @mail = Mail.create_message_to_list(msg, recipient, list)
+ 
++      if msg_scrubbed
++        @mail.add_pseudoheader(:note, I18n.t("pseudoheaders.scrubbed_message"))
++      end
++
+       error = run_filters('pre')
+       return error if error
+ 
+Index: schleuder/locales/de.yml
+===================================================================
+--- schleuder.orig/locales/de.yml	2020-04-17 08:24:04.141567850 +0000
++++ schleuder/locales/de.yml	2020-04-17 08:33:43.800384545 +0000
+@@ -252,6 +252,7 @@
+   pseudoheaders:
+     stripped_html_from_multialt: Diese Email enthielt einen alternativen HTML-Teil, der PGP-Daten beinhaltete. Der HTML-Teil wurde entfernt, um die Email sauberer analysieren zu können.
+     stripped_html_from_multialt_with_keywords: Diese Email enthielt Schlüsselwörter und einen alternativen HTML-Teil. Der HTML-Teil wurde entfernt, um zu verhindern dass diese Schlüsselwörter Aussenstehenden bekannt werden.
++    scrubbed_message: Diese Email enthielt ungültige Zeichen, die aus Verarbeitungsgründen möglicherweise entfernt wurden.
+   signature_states:
+     unknown: "Unbekannte Signatur von unbekanntem Schlüssel 0x%{fingerprint}"
+     unsigned: "Unsigniert"
+Index: schleuder/locales/en.yml
+===================================================================
+--- schleuder.orig/locales/en.yml	2020-04-17 08:24:04.145567898 +0000
++++ schleuder/locales/en.yml	2020-04-17 08:34:11.956711147 +0000
+@@ -256,6 +256,7 @@
+   pseudoheaders:
+     stripped_html_from_multialt: This message included an alternating HTML-part that contained PGP-data. The HTML-part was removed to enable parsing the message more properly.
+     stripped_html_from_multialt_with_keywords: This message included keywords and an alternating HTML-part. The HTML-part was removed to prevent the disclosure of these keywords to third parties.
++    scrubbed_message: This message included invalid characters, which might have been removed to be able to process the message properly.
+   signature_states:
+     unknown: "Unknown signature by unknown key 0x%{fingerprint}"
+     unsigned: "Unsigned"
+Index: schleuder/schleuder.gemspec
+===================================================================
+--- schleuder.orig/schleuder.gemspec	2020-04-17 08:24:04.145567898 +0000
++++ schleuder/schleuder.gemspec	2020-04-17 08:34:58.701252785 +0000
+@@ -41,6 +41,7 @@
+   s.add_runtime_dependency 'sinatra-contrib', '~> 1'
+   s.add_runtime_dependency 'thor', '~> 0'
+   s.add_runtime_dependency 'thin', '~> 1'
++  s.add_runtime_dependency 'charlock_holmes', '~> 0.7.6'
+   s.add_development_dependency 'rspec', '~> 3.5.0'
+   s.add_development_dependency 'hirb'
+   s.add_development_dependency 'factory_bot'
+Index: schleuder/spec/fixtures/mails/charset_mails/signed_utf8.eml
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/signed_utf8.eml	2020-04-17 08:41:39.213852654 +0000
+@@ -0,0 +1,110 @@
++Return-Path: <example@example.org>
++Delivered-To: input@example.org
++Received: from mx-a.example.org (mx-a.example.org [10.11.12.13])
++	by mx-b.example.org (Postfix) with ESMTPS id B783D9
++	for <support@example.org>; Wed, 06 Mar 2020 16:11:03 +0000 (UTC)
++MIME-Version: 1.0
++Date: Wed, 06 Mar 2020 16:11:03 +0000
++From: example@example.org
++To: input@example.org
++Subject: foobar
++Message-ID: <foobar@example.org>
++Content-Type: multipart/signed;
++ protocol="application/pgp-signature";
++ boundary="=_3af29082653c11eaa9c874e5f9e4031";
++ micalg=pgp-sha256
++
++This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
++
++--=_3af29082653c11eaa9c874e5f9e4031
++Content-Type: multipart/mixed;
++ boundary="=_7A9795606B8711EAA9CA74E5F9E4031"
++
++--=_7A9795606B8711EAA9CA74E5F9E4031
++Content-Transfer-Encoding: 8bit
++Content-Type: text/plain; charset=UTF-8;
++ format=flowed
++
++Hi,
++
++Wie geht es dir?
++
++Danke und liebe Grüße!
++
++Input von example.org
++--=_7A9795606B8711EAA9CA74E5F9E4031
++Content-Transfer-Encoding: 7bit
++Content-Type: application/pgp-keys;
++ name=0x4DCFFC92.asc
++Content-Disposition: attachment;
++ filename=0x4DCFFC92.asc;
++ size=3813
++
++-----BEGIN PGP PUBLIC KEY BLOCK-----
++
++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
++LBrw
++=8kNQ
++-----END PGP PUBLIC KEY BLOCK-----
++
++--=_7A9795606B8711EAA9CA74E5F9E4031
++
++--=_3af29082653c11eaa9c874e5f9e4031
++Content-Type: application/pgp-signature;
++ name=signature.asc
++Content-Disposition: attachment;
++ filename=signature.asc;
++ size=833
++Content-Description: OpenPGP digital signature
++
++-----BEGIN PGP SIGNATURE-----
++
++iQGzBAABCgAdFiEEutGcDyP9I0JgSi5RsAgBRQs6K6QFAl5rnV0ACgkQsAgBRQs6
++K6Rwawv9H1cIwmmwmJJq4xSXNHBcx1uoE38+0UNb4QrwvDZ4qTPxljrtzHecp0Jh
++ZGB1NrEyDA0ZX298eXQwyHbiGZ8BJAxG1akLmLKGpQ2CRsuy96G4Ot3nfdsVCwPD
++YHyxEH8YGk85BSpjl+RZpI7EUTLF3k9NB8szKEhqY8ZgdC4H2n4mCeXNLATO/6GP
++qFevJtFK8LAUy1S0lQQ/Y5zWpdT/GJs6MLURhtGGEiv4TLyzcRXpu04h2TBeDlT6
++Tn5YfYn1sz55rbLtQo5jmD8PwNwcsElbNQiXPdL22JyinxRz6hBAVgPVMm/bWze6
++K3RvzpQ0UoZrdhCgR3PZfe8cyJPvHMyy5g2IkvlN2BbdrqknCMkSyUlo/nmpMf3Z
++78RP2TLOeG+JNaEmmF5LuhVRp86A3ItaMjUy1RRdqjRxoXdbqUjjcMiBMPg317Oj
++9v/CJytsOXo0LHRQXdNkxPOzosUVDTPuafaqNwT1IwBpc5nKLTV2K3PS55tQ6566
++EdSR1zEh
++=/aB0
++-----END PGP SIGNATURE-----
++
++--=_3af29082653c11eaa9c874e5f9e4031--
+Index: schleuder/spec/fixtures/mails/charset_mails/thunderbird-multi-alt-html.eml
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ schleuder/spec/fixtures/mails/charset_mails/thunderbird-multi-alt-html.eml	2020-04-17 08:42:02.146113504 +0000
+@@ -0,0 +1,84 @@
++From: foo bar <foo@example.org>
++To: input@example.org
++Subject: =?UTF-8?Q?input_f=c3=bcr_Test?=
++Message-ID: <435093879857398573985735@example.org>
++Date: Fr, 12 Mar 2020 09:49:01 +0500
++User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0)
++ Gecko/20100101 Thunderbird/60.9.1
++MIME-Version: 1.0
++Content-Type: multipart/alternative;
++ boundary="------------421BD2D66A2A11EAB33E74E5F9E4031"
++
++This is a multi-part message in MIME format.
++--------------421BD2D66A2A11EAB33E74E5F9E4031
++Content-Type: text/plain; charset=utf-8
++Content-Transfer-Encoding: quoted-printable
++
++liebes example.org team,
++
++Wie geht es euch?
++
++Wir haben uns schon Gedanken gemacht:
++example.org
++
++danke für euren Support!
++
++gr=C3=BC=C3=9Fe
++
++foo bar
++
++--------------421BD2D66A2A11EAB33E74E5F9E4031
++Content-Type: text/html; charset=utf-8
++Content-Transfer-Encoding: 8bit
++
++<html>
++  <head>
++
++    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
++  </head>
++  <body text="#000000" bgcolor="#FFFFFF">
++    <p>liebes example.org team,</p>
++    <p>Wie geht es euch? <br>
++    </p>
++    <p>Wir haben uns schon Gedanken gemacht: <span
++        style="caret-color: rgb(77, 69, 69); color: rgb(77, 69, 69);
++        font-family: Roboto; font-size: 15px; font-style: normal;
++        font-variant-caps: normal; font-weight: normal; letter-spacing:
++        0.5px; orphans: auto; text-align: start; text-indent: 0px;
++        text-transform: none; white-space: normal; widows: auto;
++        word-spacing: 0px; -webkit-text-size-adjust: auto;
++        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
++        255); text-decoration: none; display: inline !important; float:
++        none;">example.org</span></p>
++    <p><span style="caret-color: rgb(77, 69, 69); color: rgb(77, 69,
++        69); font-family: Roboto; font-size: 15px; font-style: normal;
++        font-variant-caps: normal; font-weight: normal; letter-spacing:
++        0.5px; orphans: auto; text-align: start; text-indent: 0px;
++        text-transform: none; white-space: normal; widows: auto;
++        word-spacing: 0px; -webkit-text-size-adjust: auto;
++        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
++        255); text-decoration: none; display: inline !important; float:
++        none;">danke für euren Support! </span></p>
++    <p><span style="caret-color: rgb(77, 69, 69); color: rgb(77, 69,
++        69); font-family: Roboto; font-size: 15px; font-style: normal;
++        font-variant-caps: normal; font-weight: normal; letter-spacing:
++        0.5px; orphans: auto; text-align: start; text-indent: 0px;
++        text-transform: none; white-space: normal; widows: auto;
++        word-spacing: 0px; -webkit-text-size-adjust: auto;
++        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
++        255); text-decoration: none; display: inline !important; float:
++        none;">grüße</span></p>
++    <p><span style="caret-color: rgb(77, 69, 69); color: rgb(77, 69,
++        69); font-family: Roboto; font-size: 15px; font-style: normal;
++        font-variant-caps: normal; font-weight: normal; letter-spacing:
++        0.5px; orphans: auto; text-align: start; text-indent: 0px;
++        text-transform: none; white-space: normal; widows: auto;
++        word-spacing: 0px; -webkit-text-size-adjust: auto;
++        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
++        255); text-decoration: none; display: inline !important; float:
++        none;">foo bar<br>
++      </span></p>
++  </body>
++</html>
++
++--------------421BD2D66A2A11EAB33E74E5F9E4031--
+Index: schleuder/spec/schleuder/unit/list_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/unit/list_spec.rb	2020-04-17 08:24:04.149567946 +0000
++++ schleuder/spec/schleuder/unit/list_spec.rb	2020-04-17 08:41:06.517480810 +0000
+@@ -616,7 +616,7 @@
+       mail.subject = 'Something'
+       mail.body = "Some content"
+ 
+-      Schleuder::Runner.new().run(mail, list.email)
++      Schleuder::Runner.new().run(mail.to_s, list.email)
+       messages = Mail::TestMailer.deliveries
+       recipients = messages.map { |m| m.to.first }.sort
+ 
+@@ -644,7 +644,7 @@
+       mail.subject = 'Something'
+       mail.body = "Some content"
+ 
+-      Schleuder::Runner.new().run(mail, list.email)
++      Schleuder::Runner.new().run(mail.to_s, list.email)
+       messages = Mail::TestMailer.deliveries
+       recipients = messages.map { |m| m.to.first }.sort
+ 
+@@ -671,7 +671,7 @@
+       mail.subject = 'Something'
+       mail.body = "Some content"
+ 
+-      Schleuder::Runner.new().run(mail, list.email)
++      Schleuder::Runner.new().run(mail.to_s, list.email)
+       messages = Mail::TestMailer.deliveries
+       recipients = messages.map { |m| m.to.first }.sort
+ 
+@@ -700,7 +700,7 @@
+       mail.subject = 'Something'
+       mail.body = "Some content"
+ 
+-      Schleuder::Runner.new().run(mail, list.email)
++      Schleuder::Runner.new().run(mail.to_s, list.email)
+       messages = Mail::TestMailer.deliveries
+       recipients = messages.map { |m| m.to.first }.sort
+ 
+Index: schleuder/lib/schleuder/mail/message.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/mail/message.rb	2020-04-17 08:24:04.141567850 +0000
++++ schleuder/lib/schleuder/mail/message.rb	2020-04-17 08:44:18.215661998 +0000
+@@ -245,11 +245,11 @@
+       # decide itself how to encode, it works. If we don't, some
+       # character-sequences are not properly re-encoded.
+       part.content_transfer_encoding = nil
+-      # Make the converted strings (now UTF-8) match what mime-part's headers say,
+-      # fall back to US-ASCII if none is set.
+-      # https://tools.ietf.org/html/rfc2046#section-4.1.2
+-      # -> Default charset is US-ASCII
+-      part.body = lines.compact.join.encode(part.charset||'US-ASCII')
++
++      # Set the right charset on the now parsed body
++      new_body = lines.compact.join
++      part.charset = new_body.encoding.to_s
++      part.body = new_body
+ 
+       @keywords
+     end
+Index: schleuder/spec/schleuder/runner_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/runner_spec.rb	2020-04-17 08:24:04.149567946 +0000
++++ schleuder/spec/schleuder/runner_spec.rb	2020-04-17 08:48:56.066827088 +0000
+@@ -473,6 +473,43 @@
+ 
+       teardown_list_and_mailer(list)
+     end
++
++    it 'falling back works also with non-ascii content' do
++      list = create(:list, send_encrypted_only: false)
++      list.subscribe("admin@example.org", "59C71FB38AEE22E091C78259D06350440F759BD3", true)
++
++      # manually build a specific mail structure that comes without a charset
++      mail = Mail.new
++      mail.from = "admin@example.org"
++      mail.to = list.request_address
++      ENV['GNUPGHOME'] = list.listdir
++      cipher_data = GPGME::Data.new
++      GPGME::Ctx.new({armor: true}) do |ctx|
++        ctx.add_signer(*GPGME::Key.find(:secret, "59C71FB38AEE22E091C78259D06350440F759BD3", :sign))
++        ctx.encrypt_sign(
++          GPGME::Key.find(:public,list.fingerprint, :encrypt),
++          GPGME::Data.new("Content-Type: text/plain\n\nNür ein test\n"),
++          cipher_data, 0
++        )
++        cipher_data.seek(0)
++      end
++
++      mail.content_type "multipart/encrypted; boundary=\"#{mail.boundary}\"; protocol=\"application/pgp-encrypted\""
++      ver_part = Mail::Part.new do
++        body "Version: 1"
++        content_type "application/pgp-encrypted"
++      end
++      mail.add_part ver_part
++      enc_part = Mail::Part.new do
++        body cipher_data.to_s
++        content_type "application/octet-stream"
++      end
++      mail.add_part enc_part
++      output = process_mail(mail.to_s, list.email)
++      expect(output).to be nil
++
++      teardown_list_and_mailer(list)
++    end
+   end
+ 
+ end
+Index: schleuder/spec/schleuder/unit/filters_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/unit/filters_spec.rb	2020-04-17 08:24:04.149567946 +0000
++++ schleuder/spec/schleuder/unit/filters_spec.rb	2020-04-17 08:52:13.009072141 +0000
+@@ -27,6 +27,7 @@
+     it "strips HTML-part from multipart/alternative-message that contains ascii-armored PGP-data" do
+       list = create(:list)
+       mail = Mail.new
++      mail.list = list
+       mail.to = list.email
+       mail.from = 'outside@example.org'
+       content = encrypt_string(list, "blabla")
+@@ -79,6 +80,7 @@
+     it 'strips HTML-part from multipart/alternative-message that contains keywords' do
+       list = create(:list)
+       mail = Mail.new
++      mail.list = list
+       mail.to = list.email
+       mail.from = 'outside@example.org'
+       mail.text_part = content = 'x-resend: someone@example.org\n\nblabla'
+@@ -97,6 +99,7 @@
+     it 'does NOT strip HTML-part from multipart/alternative-message that does NOT contain keywords' do
+       list = create(:list)
+       mail = Mail.new
++      mail.list = list
+       mail.to = 'schleuder@example.org'
+       mail.from = 'outside@example.org'
+       mail.text_part = content = 'Hello someone@example.org,\n\nblabla'
diff -Nru schleuder-3.4.0/debian/patches/0023-fix-x-attach-listkey-thunderbird.patch schleuder-3.4.0/debian/patches/0023-fix-x-attach-listkey-thunderbird.patch
--- schleuder-3.4.0/debian/patches/0023-fix-x-attach-listkey-thunderbird.patch	1970-01-01 00:00:00.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0023-fix-x-attach-listkey-thunderbird.patch	2020-04-17 20:17:07.000000000 +0000
@@ -0,0 +1,138 @@
+Description: Fix x-attach-listkey with mails created by Thunderbird that include protected headers
+Applied-Upstream: https://0xacab.org/schleuder/schleuder/commit/7a3f3c9ba9494c86a44faba0fa9f203cc64eb666
+Last-Update: 2020-04-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: schleuder/lib/schleuder/plugins/attach_listkey.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/plugins/attach_listkey.rb	2020-04-17 09:25:57.552881854 +0000
++++ schleuder/lib/schleuder/plugins/attach_listkey.rb	2020-04-17 09:25:57.544881758 +0000
+@@ -1,16 +1,12 @@
+ module Schleuder
+   module ListPlugins
+     def self.attach_listkey(arguments, list, mail)
+-      filename = "#{list.fingerprint}.pgpkey"
+-      # "Mail" only really converts to multipart if the content-type is blank.
+-      mail.content_type = nil
+-      mail.add_file({
+-        filename: filename,
+-        content: list.export_key
+-      })
+-      mail.attachments[filename].content_type = 'application/pgp-keys'
+-      mail.attachments[filename].content_description = "OpenPGP public key of #{list.email}"
+-      mail.attachments[filename].content_disposition = "attachment; filename=#{filename}"
++      new_part = Mail::Part.new
++      new_part.body = list.export_key
++      new_part.content_type = 'application/pgp-keys'
++      new_part.content_description = "OpenPGP public key of #{list.email}"
++      new_part.content_disposition = "attachment; filename=#{list.fingerprint}.pgpkey"
++      mail.add_part new_part
+       nil
+     end
+   end
+Index: schleuder/spec/fixtures/mails/attach-list-key-thunderbird.eml
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ schleuder/spec/fixtures/mails/attach-list-key-thunderbird.eml	2020-04-17 09:25:57.548881806 +0000
+@@ -0,0 +1,66 @@
++From: user <user@example.net>
++To: testlist@example.net
++Message-ID: <6ce92946-85f0-075a-3577-ab5f6420d389@example.net>
++Date: Sat, 4 Jan 2020 19:43:54 +0100
++User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
++ Thunderbird/68.3.1
++MIME-Version: 1.0
++Subject: ...
++Content-Type: multipart/encrypted;
++ protocol="application/pgp-encrypted";
++ boundary="1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c"
++
++This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)
++--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c
++Content-Type: application/pgp-encrypted
++Content-Description: PGP/MIME version identification
++
++Version: 1
++
++--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c
++Content-Type: application/octet-stream; name="encrypted.asc"
++Content-Description: OpenPGP encrypted message
++Content-Disposition: inline; filename="encrypted.asc"
++
++-----BEGIN PGP MESSAGE-----
++
++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
++725O30U=
++=2AyW
++-----END PGP MESSAGE-----
++
++--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c--
+Index: schleuder/spec/schleuder/integration/keywords_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:25:57.552881854 +0000
++++ schleuder/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:25:57.548881806 +0000
+@@ -2794,6 +2794,30 @@
+     teardown_list_and_mailer(list)
+   end
+ 
++  it 'x-attach-listkey from Thunderbird with protected headers' do
++    list = create(:list, email: 'testlist@example.net')
++    list.subscribe('schleuder@example.org', '59C71FB38AEE22E091C78259D06350440F759BD3', true)
++    encrypted_mail = File.read('spec/fixtures/mails/attach-list-key-thunderbird.eml')
++
++    res = nil
++    begin
++      res = Schleuder::Runner.new().run(encrypted_mail.to_s, list.email)
++    rescue SystemExit
++    end
++    raw = Mail::TestMailer.deliveries.first
++    message = Mail.create_message_to_list(raw.to_s, list.email, list).setup
++
++    expect(message.parts.length).to eql(2)
++    expect(message.parts.last.parts.length).to eql(2)
++    expect(message.parts.last.parts.first.decoded).to eql("Hallo\r\n\r\nkurz mal testen, wie ein resend mail, wo zusätzlich der listkey attached\r\nist bei euch so ankommt.\r\n\r\nich habe das gefühl hier ist as broken.\r\n\r\n\r\n\r\n\r\n")
++    expect(message.parts.last.parts.last.content_type.to_s).to eql('application/pgp-keys')
++    expect(message.parts.last.parts.last.body.decoded).to match(/pub   4096R\/59C71FB38AEE22E091C78259D06350440F759BD3 \d{4}-\d{2}-\d{2}/)
++    expect(message.parts.last.parts.last.body.decoded).to include('-----BEGIN PGP PUBLIC KEY BLOCK-----')
++    expect(message.parts.last.parts.last.body.decoded).to include('mQINBFhGvz0BEADXbbTWo/PStyTznAo/f1UobY0EiVPNKNERvYua2Pnq8BwOQ5bS')
++
++    teardown_list_and_mailer(list)
++  end
++
+   it "x-get-version" do
+     list = create(:list)
+     list.subscribe("schleuder@example.org", '59C71FB38AEE22E091C78259D06350440F759BD3', true)
diff -Nru schleuder-3.4.0/debian/patches/0024-x-add-key-qp-encoded-attachments.patch schleuder-3.4.0/debian/patches/0024-x-add-key-qp-encoded-attachments.patch
--- schleuder-3.4.0/debian/patches/0024-x-add-key-qp-encoded-attachments.patch	1970-01-01 00:00:00.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0024-x-add-key-qp-encoded-attachments.patch	2020-04-17 20:17:07.000000000 +0000
@@ -0,0 +1,77 @@
+Description: Fix for x-add-key to recognize mails with attached, quoted-printable encoded keys. 
+ Such mails might be produced by Thunderbird.
+Applied-Upstream: https://0xacab.org/schleuder/schleuder/-/commit/0e26a3195da652b8abf79d02d5bdfda168d3153f
+Last-Update: 2020-04-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: schleuder/lib/schleuder/plugins/key_management.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/plugins/key_management.rb	2020-04-17 08:24:04.141567850 +0000
++++ schleuder/lib/schleuder/plugins/key_management.rb	2020-04-17 09:21:42.601814130 +0000
+@@ -105,10 +105,10 @@
+     private
+ 
+     def self.is_armored_key?(material)
+-      return false unless /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/ =~ material
+-      return false unless /^-----END PGP PUBLIC KEY BLOCK-----$/ =~ material
++      return false unless /^-----BEGIN PGP PUBLIC KEY BLOCK-----\r?$/ =~ material
++      return false unless /^-----END PGP PUBLIC KEY BLOCK-----\r?$/ =~ material
+ 
+-      lines = material.split("\n").reject(&:empty?)
++      lines = material.split(/\r?\n/).reject(&:empty?)
+       # remove header
+       lines.shift
+       # remove tail
+Index: schleuder/spec/schleuder/integration/keywords_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:16:55.000000000 +0000
++++ schleuder/spec/schleuder/integration/keywords_spec.rb	2020-04-17 09:23:10.530878559 +0000
+@@ -1294,6 +1294,48 @@
+     teardown_list_and_mailer(list)
+   end
+ 
++  it "x-add-key with attached quoted-printable key-material (as produced by Thunderbird)" do
++    list = create(:list, keywords_admin_notify: [])
++    list.subscribe("schleuder@example.org", '59C71FB38AEE22E091C78259D06350440F759BD3', true)
++    list_keys_num = list.keys.size
++    ENV['GNUPGHOME'] = list.listdir
++    mail = Mail.new
++    mail.to = list.request_address
++    mail.from = list.admins.first.email
++    gpg_opts = {
++      encrypt: true,
++      keys: {list.request_address => list.fingerprint},
++      sign: true,
++      sign_as: list.admins.first.fingerprint
++    }
++    mail.gpg(gpg_opts)
++    keywords = Mail::Part.new
++    keywords.body = "\n\nx-list-name: #{list.email}\nX-ADD-KEY:"
++    mail.parts << keywords
++    mail.attachments['example_key.txt'] = {
++      :content_type => '"application/pgp-keys"; name="example_key.txt"',
++      :content_transfer_encoding => 'quoted-printable',
++      :content => File.read('spec/fixtures/example_key.txt')
++    }
++    mail.deliver
++
++    encrypted_mail = Mail::TestMailer.deliveries.first
++    Mail::TestMailer.deliveries.clear
++
++    begin
++      Schleuder::Runner.new().run(encrypted_mail.to_s, list.request_address)
++    rescue SystemExit
++    end
++    raw = Mail::TestMailer.deliveries.first
++    message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
++
++    expect(list.keys.size).to eql(list_keys_num + 1)
++    expect(message.to).to eql(['schleuder@example.org'])
++    expect(message.first_plaintext_part.body.to_s).to match(/^This key was newly added:\n0xC4D60F8833789C7CAA44496FD3FFA6613AB10ECE schleuder2@example.org \d{4}-\d{2}-\d{2}\n$/)
++
++    teardown_list_and_mailer(list)
++  end
++
+   it "x-add-key to update a key" do
+     list = create(:list, keywords_admin_notify: [])
+     list.subscribe("schleuder@example.org", '59C71FB38AEE22E091C78259D06350440F759BD3', true)
diff -Nru schleuder-3.4.0/debian/patches/series schleuder-3.4.0/debian/patches/series
--- schleuder-3.4.0/debian/patches/series	2020-01-27 10:28:36.000000000 +0000
+++ schleuder-3.4.0/debian/patches/series	2020-04-17 20:17:07.000000000 +0000
@@ -1,3 +1,5 @@
+0024-x-add-key-qp-encoded-attachments.patch
+0023-fix-x-attach-listkey-thunderbird.patch
 0022-ASCII-8BIT-encoding.patch
 0021-handle-decryption-errors-gracefully.patch
 0020-admin-notifications-list-id-header.patch

Reply to: