Bug#1028513: dovecot: autopkgtest failure with python3.11

2023-01-19 Thread Sebastiaan Couwenberg

Control: tags -1 pending

On 1/12/23 08:10, Bas Couwenberg wrote:

The attached patch resolves the issue by using python3-passlib which has a pure 
Python implementation to fall back on when the crypt module is not available.


I've uploaded a 0-day NMU with the patch from this issue.

The changes are attached and pushed to the repo on Salsa:


https://salsa.debian.org/debian/dovecot/-/commits/debian/1%252.3.19.1+dfsg1-2.1

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
diff --git a/debian/changelog b/debian/changelog
index 14c1e62e2..22c9a9ce8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+dovecot (1:2.3.19.1+dfsg1-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * [b02ebc9] Don't use deprecated crypt module.
+(closes: #1028513)
+
+ -- Bas Couwenberg   Fri, 20 Jan 2023 07:01:26 +0100
+
 dovecot (1:2.3.19.1+dfsg1-2) unstable; urgency=medium
 
   [ Christian Göttsche ]
diff --git a/debian/tests/control b/debian/tests/control
index 106e5d04a..496cfcc0b 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -11,4 +11,4 @@ Restrictions: needs-root, breaks-testbed, allow-stderr
 
 Tests: testmails
 Restrictions: needs-root, breaks-testbed
-Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3
+Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3, python3-passlib
diff --git a/debian/tests/testmails b/debian/tests/testmails
index 71ae3caab..3329809b5 100755
--- a/debian/tests/testmails
+++ b/debian/tests/testmails
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import crypt
 import grp
 import imaplib
 import os
@@ -13,6 +12,8 @@ import subprocess
 import sys
 import unittest
 
+from passlib.hash import des_crypt
+
 
 def random_string(length):
 '''Return a random string, consisting of ASCII letters, with given
@@ -57,7 +58,7 @@ class TestUser:
 
 self.salt = random_string(2)
 self.password = random_string(8)
-self.crypted = crypt.crypt(self.password, self.salt)
+self.crypted = des_crypt.using(salt=self.salt).hash(self.password)
 
 subprocess.check_call(['useradd', '-p', self.crypted, '-m', login])
 


Bug#1028513: dovecot: autopkgtest failure with python3.11

2023-01-11 Thread Bas Couwenberg
Source: dovecot
Version: 1:2.3.19.1+dfsg1-2
Severity: serious
Tags: patch
Justification: autopkgtest failure

Dear Maintainer,

The autopkgtest for your package fails with python3.11 because the crypt module 
is deprecated:

 autopkgtest [17:21:34]: test testmails: [---
 /tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
   import crypt
 test_imap (__main__.DovecotBasics.test_imap)
 Test IMAP4 protocol. ... ok
 test_imaps (__main__.DovecotBasics.test_imaps)
 Test IMAP4S protocol. ... ok
 test_pop3 (__main__.DovecotBasics.test_pop3)
 Test POP3 protocol. ... ok
 test_pop3s (__main__.DovecotBasics.test_pop3s)
 Test POP3S protocol. ... ok
 
 --
 Ran 4 tests in 78.337s
 
 OK
 autopkgtest [17:22:53]: test testmails: ---]
 autopkgtest [17:22:53]: test testmails:  - - - - - - - - - - results - - - - - 
- - - - -
 testmailsFAIL stderr: 
/tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
 autopkgtest [17:22:53]: test testmails:  - - - - - - - - - - stderr - - - - - 
- - - - -
 /tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
   import crypt
 autopkgtest [17:22:53]:  summary
 doveadm  PASS
 systemd  PASS
 command1 PASS
 testmailsFAIL stderr: 
/tmp/autopkgtest-lxc.pzurscq6/downtmp/build.WWw/src/debian/tests/testmails:3: 
DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13

The attached patch resolves the issue by using python3-passlib which has a pure 
Python implemention to fall back on when the crypt module is not available.

Kind Regards,

Bas
>From b02ebc95e735a488c6a71b2f68774dd7332d16ff Mon Sep 17 00:00:00 2001
From: Bas Couwenberg 
Date: Thu, 12 Jan 2023 08:04:19 +0100
Subject: Don't use deprecated crypt module.

---
 debian/tests/control   | 2 +-
 debian/tests/testmails | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/tests/control b/debian/tests/control
index 106e5d04a..496cfcc0b 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -11,4 +11,4 @@ Restrictions: needs-root, breaks-testbed, allow-stderr
 
 Tests: testmails
 Restrictions: needs-root, breaks-testbed
-Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3
+Depends: dovecot-imapd, dovecot-pop3d, lsb-release, python3, python3-passlib
diff --git a/debian/tests/testmails b/debian/tests/testmails
index 71ae3caab..3329809b5 100755
--- a/debian/tests/testmails
+++ b/debian/tests/testmails
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import crypt
 import grp
 import imaplib
 import os
@@ -13,6 +12,8 @@ import subprocess
 import sys
 import unittest
 
+from passlib.hash import des_crypt
+
 
 def random_string(length):
 '''Return a random string, consisting of ASCII letters, with given
@@ -57,7 +58,7 @@ class TestUser:
 
 self.salt = random_string(2)
 self.password = random_string(8)
-self.crypted = crypt.crypt(self.password, self.salt)
+self.crypted = des_crypt.using(salt=self.salt).hash(self.password)
 
 subprocess.check_call(['useradd', '-p', self.crypted, '-m', login])
 
-- 
2.30.2