Control: tags 981063 patch

On 2021-01-25, Vagrant Cascadian wrote:
> When I use the remotepassfile feature, where the specified
> remotepassfile is a single-line plain text file, it fails with a
> traceback.

This attached patch fixes the issue for me. I haven't done extensive
testing for other use-cases, though it only changes the remotepassfile
codepath.

live well,
  vagrant
From d04e63080359b2926a9b8e4582f3387f4e09528c Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Mon, 25 Jan 2021 12:46:01 -0800
Subject: [PATCH] Add patch to fix remotepassfile by not encoding into UTF-8.
 (Closes: #981063)

---
 ...ssword-in-UTF-8-when-reading-from-re.patch | 28 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 debian/patches/0001-Do-not-encode-password-in-UTF-8-when-reading-from-re.patch

diff --git a/debian/patches/0001-Do-not-encode-password-in-UTF-8-when-reading-from-re.patch b/debian/patches/0001-Do-not-encode-password-in-UTF-8-when-reading-from-re.patch
new file mode 100644
index 0000000..228cee5
--- /dev/null
+++ b/debian/patches/0001-Do-not-encode-password-in-UTF-8-when-reading-from-re.patch
@@ -0,0 +1,28 @@
+From 4f5d97e91e6c0b732120a1c02b6e728068c77e23 Mon Sep 17 00:00:00 2001
+From: Vagrant Cascadian <[email protected]>
+Date: Mon, 25 Jan 2021 12:44:06 -0800
+Subject: [PATCH] Do not encode password in UTF-8 when reading from
+ "remotepassfile".
+
+https://bugs.debian.org/981063
+
+---
+ offlineimap/repository/IMAP.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py
+index b732243..6fb7f4a 100644
+--- a/offlineimap/repository/IMAP.py
++++ b/offlineimap/repository/IMAP.py
+@@ -590,7 +590,7 @@ class IMAPRepository(BaseRepository):
+                              encoding='utf-8')
+             password = file_desc.readline().strip()
+             file_desc.close()
+-            return password.encode('UTF-8')
++            return password
+         # 4. Read password from ~/.netrc.
+         try:
+             netrcentry = netrc.netrc().authenticators(self.gethost())
+-- 
+2.29.2
+
diff --git a/debian/patches/series b/debian/patches/series
index a3648df..c736d39 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 Revert-implement-Happy-Eyeballs.patch
 Do-not-use-the-Internet-to-fetch-DTD.patch
+0001-Do-not-encode-password-in-UTF-8-when-reading-from-re.patch
-- 
2.29.2

Attachment: signature.asc
Description: PGP signature

Reply via email to