diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5cf2932..10ce291 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -2,9 +2,9 @@ name: build on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: build: @@ -13,12 +13,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3775d62..7326a7e 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip setuptools wheel twine diff --git a/requirements-dev.txt b/requirements-dev.txt index 597f195..32ecb8f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ pytest >= 4 pytest-cov pyright -pymox +pymox @ git+https://github.com/slimta/pymox-maint.git@0723b819d25d2d1f8507456d299ae70f864e3ea4 testfixtures flake8 twine diff --git a/setup.py b/setup.py index 01ad1cd..6e1052d 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ license = f.read() setup(name='python-slimta', - version='5.0.4', + version='5.0.5', author='Ian Good', author_email='ian@icgood.net', description='Lightweight, asynchronous SMTP libraries.', @@ -39,7 +39,7 @@ include_package_data=True, packages=find_namespace_packages(include=['slimta.*']), install_requires=['gevent >= 1.1', - 'pysasl >= 0.5.0', + 'pysasl >= 1', 'pycares >= 1'], extras_require={'spf': ['pyspf', 'py3dns'], 'redis': ['redis'], @@ -54,7 +54,8 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10']) + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11']) # vim:et:fdm=marker:sts=4:sw=4:ts=4 diff --git a/slimta/smtp/auth.py b/slimta/smtp/auth.py index fce7361..fb68115 100644 --- a/slimta/smtp/auth.py +++ b/slimta/smtp/auth.py @@ -24,8 +24,9 @@ import re import base64 -from pysasl import AuthenticationError, ServerChallenge, ChallengeResponse -from pysasl.creds import AuthenticationCredentials +from pysasl.mechanism import ServerChallenge, ChallengeResponse +from pysasl.creds.client import ClientCredentials +from pysasl.exception import AuthenticationError from . import SmtpError from .reply import Reply @@ -167,7 +168,7 @@ def client_attempt(self, authcid, secret, authzid, mech_name): mechanism = self.auth.get_client(mech_name) if not mechanism: raise InvalidMechanismError() - creds = AuthenticationCredentials(authcid, secret, authzid) + creds = ClientCredentials(authcid, secret, authzid) responses = [] resp = mechanism.client_attempt(creds, responses) chal, reply = self._client_respond( diff --git a/test/test_slimta_smtp_auth.py b/test/test_slimta_smtp_auth.py index 0b6dd26..84777e7 100644 --- a/test/test_slimta_smtp_auth.py +++ b/test/test_slimta_smtp_auth.py @@ -4,6 +4,7 @@ from mox import MoxTestBase, IsA from gevent.ssl import SSLSocket from pysasl import SASLAuth +from pysasl.identity import ClearIdentity from slimta.smtp.io import IO from slimta.smtp.auth import AuthSession, \ @@ -38,16 +39,16 @@ def test_plain_noarg(self): auth = AuthSession(SASLAuth.defaults(), self.io) result = auth.server_attempt(b'PLAIN') self.assertEqual(u'testuser', result.authcid) - self.assertEqual(u'testpassword', result.secret) self.assertEqual(u'testzid', result.authzid) + self.assertTrue(result.verify(ClearIdentity(u'testuser', u'testpassword'))) def test_plain(self): self.mox.ReplayAll() auth = AuthSession(SASLAuth.defaults(), self.io) result = auth.server_attempt(b'PLAIN dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=') self.assertEqual(u'testuser', result.authcid) - self.assertEqual(u'testpassword', result.secret) self.assertEqual(u'testzid', result.authzid) + self.assertTrue(result.verify(ClearIdentity(u'testuser', u'testpassword'))) def test_plain_canceled(self): self.sock.sendall(b'334 \r\n') @@ -68,8 +69,8 @@ def test_login_noarg(self): auth = AuthSession(SASLAuth.defaults(), self.io) result = auth.server_attempt(b'LOGIN') self.assertEqual(u'testuser', result.authcid) - self.assertEqual(u'testpassword', result.secret) - self.assertEqual(None, result.authzid) + self.assertEqual(u'testuser', result.authzid) + self.assertTrue(result.verify(ClearIdentity(u'testuser', u'testpassword'))) def test_login(self): self.sock.sendall(b'334 UGFzc3dvcmQ6\r\n') @@ -78,8 +79,8 @@ def test_login(self): auth = AuthSession(SASLAuth.defaults(), self.io) result = auth.server_attempt(b'LOGIN dGVzdHVzZXI=') self.assertEqual(u'testuser', result.authcid) - self.assertEqual(u'testpassword', result.secret) - self.assertEqual(None, result.authzid) + self.assertEqual(u'testuser', result.authzid) + self.assertTrue(result.verify(ClearIdentity(u'testuser', u'testpassword'))) def test_client_bad_mech(self): self.sock.sendall(b'AUTH LOGIN\r\n')