Bug#981063: offlineimap3: traceback when using "remotepassfile" option

2021-02-07 Thread Sudip Mukherjee
On Sun, Feb 7, 2021 at 1:15 AM Cyril Brulebois  wrote:
>
> Hi,
>
> Vagrant Cascadian  (2021-01-25):
> > 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.
>
> Thanks for the patch! I can confirm this fixes the issue for me as well
> after installing a fresh bullseye system and carrying over my local
> config (from the stretch era).

Thanks to both of you. I am just waiting for the upstream to confirm the fix.


-- 
Regards
Sudip



Bug#981063: offlineimap3: traceback when using "remotepassfile" option

2021-02-06 Thread Cyril Brulebois
Hi,

Vagrant Cascadian  (2021-01-25):
> 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.

Thanks for the patch! I can confirm this fixes the issue for me as well
after installing a fresh bullseye system and carrying over my local
config (from the stretch era).


Cheers,
-- 
Cyril Brulebois (k...@debian.org)
D-I release manager -- Release team member -- Freelance Consultant


signature.asc
Description: PGP signature


Bug#981063: offlineimap3: traceback when using "remotepassfile" option

2021-01-25 Thread Vagrant Cascadian
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 
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 000..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 
+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



signature.asc
Description: PGP signature


Bug#981063: offlineimap3: traceback when using "remotepassfile" option

2021-01-25 Thread Vagrant Cascadian
Package: offlineimap3
Version: 0.0~git20210105.00d395b+dfsg-2
Severity: important
X-Debbugs-Cc: Vagrant Cascadian 

Thanks for the work porting and maintaining offlineimap for python3!


When I use the remotepassfile feature, where the specified
remotepassfile is a single-line plain text file, it fails with a
traceback.

If I use the default ui interface and comment out the remotepassfile
option for that account, it works fine.


  $ offlineimap -u quiet -q -a ACCOUNT
  ERROR: While attempting to sync account 'ACCOUNT'
sequence item 2: expected str instance, bytes found
  ERROR: Exceptions occurred during the run!
  ERROR: While attempting to sync account 'ACCOUNT'
sequence item 2: expected str instance, bytes found
  
  Traceback:
File "/usr/share/offlineimap3/offlineimap/accounts.py", line 298, in
syncrunner
  self.__sync()
File "/usr/share/offlineimap3/offlineimap/accounts.py", line 374, in
__sync
  remoterepos.getfolders()
File "/usr/share/offlineimap3/offlineimap/repository/IMAP.py", line
648, in getfolders
  imapobj = self.imapserver.acquireconnection()
File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 592, in
acquireconnection
  self.__authn_helper(imapobj)
File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 449, in
__authn_helper
  if func(imapobj):
File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 375, in
__authn_plain
  imapobj.authenticate('PLAIN', self.__plainhandler)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 691, in
authenticate
  typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())
File "/usr/lib/python3/dist-packages/imaplib2.py", line 1684, in
_simple_command
  return self._command_complete(self._command(name, *args), kw)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 1404, in
_command
  literal = literator(data, rqb)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 2247, in
process
  ret = self.mech(self.decode(data))
File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 217, in
__plainhandler
  retval = NULL.join((authz, authc, passwd))


live well,
  vagrant

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (12, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: armhf, arm64

Kernel: Linux 5.10.0-2-amd64 (SMP w/4 CPU threads)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages offlineimap3 depends on:
ii  python3   3.9.1-1
ii  python3-distro1.5.0-1
ii  python3-imaplib2  2.57-5.2

offlineimap3 recommends no packages.

offlineimap3 suggests no packages.

-- no debconf information


signature.asc
Description: PGP signature