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

Dear SRMs,

Schleuder in buster (proposed-updates) is affected by various problems, which I
would like to fix:

  - Add missing List-Id header to notification mails sent to admins:
    This should help with filtering such messages, which is currently
    not easy to do in a reliable way. (Closes: #948980)

  - Handle various exceptions due to decryption problems gracefully:
    Handle incoming mails encrypted to an absent key, using symmetric
    encryption or containing PGP-garbage in a more graceful manner:
    Don't throw an exception, don't notify (and annoy) the admins,
    instead inform the sender of the mail how to do better.
    (Closes: #948981)
  
  - Default to ASCII-8BIT encoding for external data:
    This should ensure Schleuder is able to handle incoming mails in different
    character sets. Currently Schleuder may run into a fatal error due to
    "invalid byte sequence in US-ASCII". (Closes: #948982)

The proposed code changes are minimal, targeted, guarded by tests and validated
in production. All of them are fixed in unstable via 3.4.1-2. 

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

Thanks for your work!

Cheers,
Georg
diffstat for schleuder-3.4.0 schleuder-3.4.0

 changelog                                              |   16 
 patches/0020-admin-notifications-list-id-header.patch  |   41 ++
 patches/0021-handle-decryption-errors-gracefully.patch |  199 +++++++++++
 patches/0022-ASCII-8BIT-encoding.patch                 |  284 +++++++++++++++++
 patches/series                                         |    3 
 5 files changed, 543 insertions(+)

diff -Nru schleuder-3.4.0/debian/changelog schleuder-3.4.0/debian/changelog
--- schleuder-3.4.0/debian/changelog	2019-11-08 10:45:22.000000000 +0000
+++ schleuder-3.4.0/debian/changelog	2020-01-15 17:11:59.000000000 +0000
@@ -1,3 +1,19 @@
+schleuder (3.4.0-2+deb10u2) buster; urgency=medium
+
+  * debian/patches:
+    - Pull in upstream patch to add missing List-Id header to notification
+      mails sent to admins. (Closes: #948980)
+    - Pull in upstream patch to handle decryption problems gracefully: Handle
+      incoming mails encrypted to an absent key, using symmetric encryption or
+      containing PGP-garbage in a more graceful manner: Don't throw an
+      exception, don't notify (and annoy) the admins, instead inform the
+      sender of the mail how to do better. (Closes: #948981)
+    - Pull in upstream patch to default to ASCII-8BIT encoding. This should
+      ensure Schleuder is able to handle mails with different charsets.
+      (Closes: #948982)
+
+ -- Georg Faerber <ge...@debian.org>  Wed, 15 Jan 2020 17:11:59 +0000
+
 schleuder (3.4.0-2+deb10u1) buster; urgency=medium
 
   * debian/patches:
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	1970-01-01 00:00:00.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0020-admin-notifications-list-id-header.patch	2020-01-15 17:11:59.000000000 +0000
@@ -0,0 +1,41 @@
+Description: admin notifications: add missing List-Id header
+Author: Georg Faerber <ge...@riseup.net>
+Origin: upstream
+Forwarded: https://0xacab.org/schleuder/schleuder/merge_requests/312/diffs?commit_id=ee41fd4215bba6bea5aba12806089e9d415c1bd1
+Last-Update: 2020-01-15
+---
+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 @@
+             gpg_opts.merge!(encrypt: true, keys: { address => key.fingerprint })
+           end
+           mail.gpg gpg_opts
++
++          mail.header['List-Id'] = "<#{@list.email.gsub('@', '.')}>"
+         end
+         mail.deliver
+       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
+@@ -97,4 +97,16 @@
+     expect(message.parts.size).to be(2)
+     expect(message.parts.first.parts.first.body.to_s).to eql('Something')
+   end
++
++  it 'includes a List-Id header in notification mails sent to admins' do
++    list = create(:list, send_encrypted_only: false)
++    list.subscribe("schleu...@example.org", nil, true)
++
++    mail = Mail.new
++    list.logger.notify_admin("Something", mail.to_s, I18n.t('notice'))
++
++    message = Mail::TestMailer.deliveries.first
++
++    expect(message.header['List-Id'].to_s).to eql("<#{list.email.gsub('@', '.')}>")
++  end
+ end
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	1970-01-01 00:00:00.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0021-handle-decryption-errors-gracefully.patch	2020-01-15 17:11:59.000000000 +0000
@@ -0,0 +1,199 @@
+Description: handle decryption problems gracefully
+  Handle incoming mails encrypted to an absent key, using symmetric encryption
+  or containing PGP-garbage in a more graceful manner: Don't throw an
+  exception, don't notify (and annoy) the admins, instead inform the sender of
+  the mail how to do better.
+Author: Georg Faerber <ge...@riseup.net>
+Origin: upstream
+Applied-Upstream: https://0xacab.org/schleuder/schleuder/commit/e9475b7ffd9e640addbb111ae140c6bab0c66eb7
+Last-Update: 2020-01-15
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: schleuder/lib/schleuder/runner.rb
+===================================================================
+--- schleuder.orig/lib/schleuder/runner.rb	2019-11-03 18:31:20.993702050 +0000
++++ schleuder/lib/schleuder/runner.rb	2020-01-15 15:39:02.341710434 +0000
+@@ -13,7 +13,12 @@
+       begin
+         # This decrypts, verifies, etc.
+         @mail = @mail.setup
+-      rescue GPGME::Error::DecryptFailed
++
++      rescue GPGME::Error::BadPassphrase,
++             GPGME::Error::DecryptFailed,
++             GPGME::Error::NoData,
++             GPGME::Error::NoSecretKey
++
+         logger.warn "Decryption of incoming message failed."
+         return Errors::DecryptionFailed.new(list)
+       end
+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-15 15:39:02.341710434 +0000
+@@ -0,0 +1,28 @@
++Date: Sat, 4 Jan 2020 23:42:49 +0000
++From: <schleu...@example.org>
++To: schleu...@example.org
++Subject: Test
++Message-ID: <20200104234249.gb9...@example.org>
++MIME-Version: 1.0
++Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";
++	boundary="eAbsdosE1cNLO4uF"
++Content-Disposition: inline
++
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/pgp-encrypted
++Content-Disposition: attachment
++
++Version: 1
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/octet-stream
++Content-Disposition: attachment; filename="msg.asc"
++
++-----BEGIN PGP MESSAGE-----
++
++hF4DTO8GH8gtgSMSAQdAjiYMTVwKw70Z3H8NwyZeHpPopnE1BB2L8Cs0MF95AXYw
++=xJbn
++-----END PGP MESSAGE-----
++
++--eAbsdosE1cNLO4uF--
+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-15 15:39:02.341710434 +0000
+@@ -0,0 +1,38 @@
++Date: Sat, 4 Jan 2020 23:42:49 +0000
++From: <schleu...@example.org>
++To: schleu...@example.org
++Subject: Test
++Message-ID: <20200104234249.gb9...@example.org>
++MIME-Version: 1.0
++Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";
++	boundary="eAbsdosE1cNLO4uF"
++Content-Disposition: inline
++
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/pgp-encrypted
++Content-Disposition: attachment
++
++Version: 1
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/octet-stream
++Content-Disposition: attachment; filename="msg.asc"
++
++-----BEGIN PGP MESSAGE-----
++
++hQGMA+8L5wLeonReAQv/ch+gZBhnP0ikFnkmEXB50e3oWlP7/Gc0hRetb6s5I8u4
++dJOt9FUpaWiKg/OryBafJ889VtE7ujO2d8T+D0xwqiE9JRNzP3DiWiXgNpKw5pmN
++L6R4+skZ9UK009AzxWSivgg6fJIpk8i022n9c5DPK4sMOE2jUYV7C2BMzXcSq8jf
++vr5Wet3lf2yzfU+Pb62s8N1y/qg0PZrJb/0ddnaY4DDMPb4db3H2fuOEzuHnyxOK
++WiphCGWSKqKUUWt/x/01GABWBDCy/5HB5ow1o43u8KDriTVB765dd0aS2QGqhLD8
++yvhEnzjb1DRz5Bml7NOXKeueFL80S0vge1AKT1YOf1bW1YfTEpn0jiLr8zasd41c
++c7cM6SGX6PFV6xGTqMgHLBZaN7Xj4ijgqZfPslYJp4iqjyQ18y1S3zMBDLc3s+9T
++iihTi2Ve2D2nI7Xb1Cl/UAgRDin7pQT39UBsHtrKHbpf0NTKYQKzHk+0K+VZn1Bq
++a89bFZrfiT+iMXovAzx20loBzk6GUrmSRSgngW7ai0se4nEQ7Vj8xJV/awmBq8Oz
++O8UtXiQlIoqOXH07aLxZm819BRNy66XiRUsW0bxN/pzSbOlhivIXYm5ypy5UWEsl
++hGHDxswJibLDdpc=
++=pSCD
++-----END PGP MESSAGE-----
++
++--eAbsdosE1cNLO4uF--
+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-15 15:39:02.341710434 +0000
+@@ -0,0 +1,30 @@
++Date: Sat, 4 Jan 2020 23:42:49 +0000
++From: <schleu...@example.org>
++To: schleu...@example.org
++Subject: Test
++Message-ID: <20200104234249.gb9...@example.org>
++MIME-Version: 1.0
++Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";
++	boundary="eAbsdosE1cNLO4uF"
++Content-Disposition: inline
++
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/pgp-encrypted
++Content-Disposition: attachment
++
++Version: 1
++
++--eAbsdosE1cNLO4uF
++Content-Type: application/octet-stream
++Content-Disposition: attachment; filename="msg.asc"
++
++-----BEGIN PGP MESSAGE-----
++
++jA0ECQMCk858png0tIj/0lQBvHbaDcW9nElJfL0tgFhEnZv3847kDXaRpYAaQhAY
++TmHzD51Z7uUbalJSxgmLnBVFRFop2sKSmba1sqtlhszYFjTRerlWAJsb5vNZ1KIB
++1kyOuBU=
++=42m3
++-----END PGP MESSAGE-----
++
++--eAbsdosE1cNLO4uF--
+Index: schleuder/spec/schleuder/runner_spec.rb
+===================================================================
+--- schleuder.orig/spec/schleuder/runner_spec.rb	2019-11-03 18:31:21.009703584 +0000
++++ schleuder/spec/schleuder/runner_spec.rb	2020-01-15 15:40:20.030673164 +0000
+@@ -182,6 +182,54 @@
+       end
+     end
+ 
++    context 'mails not encrypted to the list key' do
++      it 'handles a mail which was encrypted to an absent key and returns DecryptionFailed error' do
++        list = create(
++          :list,
++          send_encrypted_only: false
++        )
++        list.subscribe("schleu...@example.org", nil, true)
++        mail = File.read('spec/fixtures/mails/encrypted-to-absent-key.txt')
++
++        result = Schleuder::Runner.new().run(mail, list.email)
++
++
++        expect(result.class).to eql(Schleuder::Errors::DecryptionFailed)
++
++        teardown_list_and_mailer(list)
++      end
++
++      it 'handles a mail which was encrypted to a passphrase and returns DecryptionFailed error' do
++        list = create(
++          :list,
++          send_encrypted_only: false
++        )
++        list.subscribe("schleu...@example.org", nil, true)
++        mail = File.read('spec/fixtures/mails/encrypted-to-passphrase.txt')
++
++        result = Schleuder::Runner.new().run(mail, list.email)
++
++        expect(result.class).to eql(Schleuder::Errors::DecryptionFailed)
++
++        teardown_list_and_mailer(list)
++      end
++
++      it 'handles a mail containing PGP-garbage and returns DecryptionFailed error' do
++        list = create(
++          :list,
++          send_encrypted_only: false
++        )
++        list.subscribe("schleu...@example.org", nil, true)
++        mail = File.read('spec/fixtures/mails/containing-pgp-garbage.txt')
++
++        result = Schleuder::Runner.new().run(mail, list.email)
++
++        expect(result.class).to eql(Schleuder::Errors::DecryptionFailed)
++
++        teardown_list_and_mailer(list)
++      end
++    end
++
+     it "delivers a signed error message if a subscription's key is expired on a encrypted-only list" do
+         list = create(:list, send_encrypted_only: true)
+         list.subscribe("ad...@example.org", nil, true, false)
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	1970-01-01 00:00:00.000000000 +0000
+++ schleuder-3.4.0/debian/patches/0022-ASCII-8BIT-encoding.patch	2020-01-15 17:11:59.000000000 +0000
@@ -0,0 +1,284 @@
+Description: Default to ASCII-8BIT encoding
+  This should ensure Schleuder is able to handle mails with different charsets.
+Author: ng <n...@immerda.ch>
+Applied-Upstream: https://0xacab.org/schleuder/schleuder/commit/92c7ead414eba3b3787c597b95ff983e32142b56
+Last-Update: 2020-01-15
+---
+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
+@@ -1,3 +1,10 @@
++# default to ASCII-8BIT 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
++
+ # Stdlib
+ require 'fileutils'
+ require 'singleton'
+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
+@@ -0,0 +1,9 @@
++MIME-Version: 1.0
++Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
++From: sen...@example.com
++To: =?UTF-8?B?44G/44GR44KL?= <schleu...@example.org>
++Content-Type: text/plain; charset=UTF-8
++Content-Transfer-Encoding: base64
++
++44GL44GN44GP44GI44GTCgotLSAKaHR0cDovL2xpbmRzYWFyLm5ldC8KUmFpbHMsIFJTcGVjIGFu
++ZCBMaWZlIGJsb2cuLi4uCg==
+\ No newline at end of file
+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
+@@ -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)
++Date: Fri, 16 Oct 2009 23:39:34 +1100
++Delivered-To: schleu...@example.org
++Message-ID: <57a815bf0910160539m64240421gb35ea52e101ae...@mail.gmail.com>
++Subject: testing
++From: sen...@example.com
++To: Schleuder <schleu...@example.org>
++Content-Type: multipart/mixed; boundary=00032557395e3572cf04760cb060
++
++--00032557395e3572cf04760cb060
++Content-Type: text/plain; charset=UTF-8
++
++testing
++
++-- 
++http://lindsaar.net/
++Rails, RSpec and Life blog....
++
++--00032557395e3572cf04760cb060
++Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?B?44Gm44GZ44GoLnR4dA==?="
++Content-Disposition: attachment; filename="=?UTF-8?B?44Gm44GZ44GoLnR4dA==?="
++Content-Transfer-Encoding: base64
++X-Attachment-Id: f_g0uxfl510
++
++dGhpcyBpcyBhIHRlc3QK44GT44KM44KP44Gm44GZ44Go
++--00032557395e3572cf04760cb060--
+\ No newline at end of file
+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
+@@ -0,0 +1,44 @@
++Delivered-To: schleu...@example.org
++Received: by 10.231.12.67 with SMTP id w3cs164325ibw;
++        Fri, 30 Oct 2009 01:11:12 -0700 (PDT)
++Received: by 10.150.44.2 with SMTP id r2mr2367210ybr.77.1256890271939;
++        Fri, 30 Oct 2009 01:11:11 -0700 (PDT)
++Return-Path: <mi...@test.lindsaar.net>
++Received: from mx1.test.lindsaar.net.au (mx1.test.lindsaar.net.au [210.14.110.240])
++        by mx.google.com with ESMTP id 25si7923673gxk.34.2009.10.30.01.11.11;
++        Fri, 30 Oct 2009 01:11:11 -0700 (PDT)
++Received-SPF: neutral (google.com: 210.14.110.240 is neither permitted nor denied by domain of mi...@test.lindsaar.net) client-ip=210.14.110.240;
++Authentication-Results: mx.google.com; spf=neutral (google.com: 210.14.110.240 is neither permitted nor denied by domain of mi...@test.lindsaar.net) smtp.mail=mi...@test.lindsaar.net
++Received: from [192.168.4.253] (60-241-138-146.static.tpgi.com.au [60.241.138.146])
++	(using TLSv1 with cipher AES128-SHA (128/128 bits))
++	(No client certificate requested)
++	(Authenticated sender: mikel)
++	by mx1.test.lindsaar.net.au (Postfix) with ESMTPSA id 5C0186DD4CD
++	for <schleu...@example.org>; Fri, 30 Oct 2009 19:11:08 +1100 (EST)
++Subject: =?utf-8?B?44G+44G/44KA44KB44KC44G+44G/44KA44KB44KC44G+44G/44KA?=
++ =?utf-8?B?44KB44KC44G+44G/44KA44KB44KC44G+44G/44KA44KB44KC44G+?=
++ =?utf-8?B?44G/44KA44KB44KC44G+44G/44KA44KB44KC44G+44G/44KA44KB?=
++ =?utf-8?B?44KC44G+44G/44KA44KB44KC44G+44G/44KA44KB44KC?=
++From: sen...@example.com
++Content-Type: multipart/mixed; boundary=Apple-Mail-6--589811753
++Message-Id: <60a112a8-f26c-4e23-95b8-4eb9f139d...@test.lindsaar.net>
++Date: Fri, 30 Oct 2009 19:11:02 +1100
++To: Schleuder <schleu...@example.org>
++Mime-Version: 1.0 (Apple Message framework v1076)
++X-Mailer: Apple Mail (2.1076)
++
++
++--Apple-Mail-6--589811753
++Content-Disposition: attachment;
++	filename*0*=utf-8''%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%8B;
++	filename*1*=%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93.txt
++Content-Type: text/plain;
++	x-unix-mode=0644;
++	name="=?utf-8?B?44GL44GN44GP44GR44GT44GL44GN44GP44GR44GT44GL44GN44GP?=
++ =?utf-8?B?44GR44GT44GL44GN44GP44GR44GT44GL44GN44GP44GR44GTLnR4?=
++ =?utf-8?B?dA==?="
++Content-Transfer-Encoding: 7bit
++
++this is the data
++
++--Apple-Mail-6--589811753--
+\ No newline at end of file
+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
+@@ -0,0 +1,10 @@
++MIME-Version: 1.0
++Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
++From: sen...@example.com
++To: =?UTF-8?B?44G/44GR44KL?= <schleu...@example.org>
++Content-Type: text/plain;
++ charset=iso-2022-jp
++Content-Transfer-Encoding: 7bit
++
++$B$9$_$^$;$s!#(B
++
+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
+@@ -0,0 +1,15 @@
++Delivered-To: schleu...@example.org
++Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
++From: sen...@example.com
++To: schleu...@example.org
++Subject: test
++Message-ID: <xx...@docomo.ne.jp>
++MIME-Version: 1.0
++Content-Type: text/plain; charset="Shift_JIS"
++Content-Transfer-Encoding: 8bit
++
++あいうえお
++
++このメールはテスト用のメールです。
++
++今後ともよろしくお願い申し上げます!
+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
+@@ -0,0 +1,11 @@
++Delivered-To: schleu...@example.org
++Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
++From: sen...@example.com
++To: schleu...@example.org
++Subject: test
++Message-ID: <f...@example.com>
++MIME-Version: 1.0
++Content-Type: text/plain; charset="ks_c_5601-1987"
++Content-Transfer-Encoding: 8bit
++
++スコニシヌリ
+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
+@@ -0,0 +1,14 @@
++Date: Wed, 28 May 2014 17:18:19 +0900 (JST)
++From: sen...@example.com
++To: schleu...@example.org
++Subject: test
++Message-ID: <xx...@docomo.ne.jp>
++MIME-Version: 1.0
++Content-Type: text/plain; charset="Shift_JIS"
++Content-Transfer-Encoding: 8bit
++
++あいうえお
++
++このメールはテスト用のメールです。
++
++今後ともよろしくお願い申し上げます!
+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
+@@ -0,0 +1,10 @@
++MIME-Version: 1.0
++Subject: =?UTF-8?B?44G+44G/44KA44KB44KC?=
++From: Mikel Lindsaar <raasd...@gmail.com>
++To: =?UTF-8?B?44G/44GR44KL?= <raasd...@gmail.com>
++Content-Type: text/plain;
++ charset=iso-2022-jp
++Content-Transfer-Encoding: 7bit
++
++$B$9$_$^$;$s!#(B
++
+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
+@@ -0,0 +1,10 @@
++Subject: test
++To: schleu...@example.org
++From: sen...@example.com
++Date: Wed, 6 Nov 2019 22:04:23 -0200
++MIME-Version: 1.0
++Content-Type: text/plain; charset=ISO-8859
++Content-Language: en-US
++Content-Transfer-Encoding: 8bit
++
++
+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
+@@ -0,0 +1,10 @@
++Subject: test
++To: schleu...@example.org
++From: sen...@example.com
++Date: Wed, 6 Nov 2019 22:04:23 -0200
++MIME-Version: 1.0
++Content-Type: text/plain; charset=utf-8
++Content-Language: en-US
++Content-Transfer-Encoding: 8bit
++
++テゥ
+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
+@@ -0,0 +1,25 @@
++require "spec_helper"
++
++describe "user sends emails with different charsets" do
++  Dir["spec/fixtures/mails/charset_mails/*.eml"].each do |f|
++    it "works with #{File.basename(f,'.eml')}" do
++      start_smtp_daemon
++      list = create(:list)
++      list.subscribe("ad...@example.org", nil, true)
++
++      # Clean any LANG from env as this is usually the case for MUAs
++      # https://0xacab.org/schleuder/schleuder/issues/409
++      with_env(ENV.delete_if {|key, value| key =~ /LANG/ || key =~ /LC/ }) do
++        error = run_schleuder(:work, list.email, f)
++        mails = Dir.glob("#{smtp_daemon_outputdir}/mail-*")
++
++        expect(error).to be_empty
++        expect(mails.size).to eq 1
++      end
++
++      stop_smtp_daemon
++    end
++  end
++end
++
++
+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
+@@ -136,6 +136,14 @@
+     `SCHLEUDER_ENV=test SCHLEUDER_CONFIG=spec/schleuder.yml bin/schleuder #{command} 2>&1`
+   end
+ 
++  def with_env(env)
++    backup = ENV.to_hash
++    ENV.replace(env)
++    yield
++  ensure
++    ENV.replace(backup)
++  end
++
+   def process_mail(msg, recipient)
+     output = nil
+     begin
diff -Nru schleuder-3.4.0/debian/patches/series schleuder-3.4.0/debian/patches/series
--- schleuder-3.4.0/debian/patches/series	2019-11-08 10:45:22.000000000 +0000
+++ schleuder-3.4.0/debian/patches/series	2020-01-15 17:11:59.000000000 +0000
@@ -1,3 +1,6 @@
+0022-ASCII-8BIT-encoding.patch
+0021-handle-decryption-errors-gracefully.patch
+0020-admin-notifications-list-id-header.patch
 0019-refresh-fetch-strip-non-self-sigs.patch
 0018-refresh_keys-no-list.patch
 0016-gemspec-update-sinatra.patch

Reply via email to