From 16bf358ae889caf016dd898d0ea6c02d590364ba Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 5 Feb 2024 20:09:56 +0000 Subject: [PATCH 1/2] Fix code scanning issue --- aiosmtpd/smtp.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/aiosmtpd/smtp.py b/aiosmtpd/smtp.py index bf352627..39e70d8b 100644 --- a/aiosmtpd/smtp.py +++ b/aiosmtpd/smtp.py @@ -943,22 +943,28 @@ async def smtp_AUTH(self, arg: str) -> None: return assert self.session is not None if not self.session.extended_smtp: - return await self.push("500 Error: command 'AUTH' not recognized") + await self.push("500 Error: command 'AUTH' not recognized") + return elif self._auth_require_tls and not self._tls_protocol: - return await self.push("538 5.7.11 Encryption required for requested " - "authentication mechanism") + await self.push("538 5.7.11 Encryption required for requested " + "authentication mechanism") + return elif self.session.authenticated: - return await self.push('503 Already authenticated') + await self.push('503 Already authenticated') + return elif not arg: - return await self.push('501 Not enough value') + await self.push('501 Not enough value') + return args = arg.split() if len(args) > 2: - return await self.push('501 Too many values') + await self.push('501 Too many values') + return mechanism = args[0] if mechanism not in self._auth_methods: - return await self.push('504 5.5.4 Unrecognized authentication type') + await self.push('504 5.5.4 Unrecognized authentication type') + return CODE_SUCCESS = "235 2.7.0 Authentication successful" CODE_INVALID = "535 5.7.8 Authentication credentials invalid" From 806f86115f2485632614a33c057c18391aa20296 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 5 Feb 2024 20:10:55 +0000 Subject: [PATCH 2/2] Update make_user_db.py --- examples/authenticated_relayer/make_user_db.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/authenticated_relayer/make_user_db.py b/examples/authenticated_relayer/make_user_db.py index 0fa3caf3..dbb2d1f7 100644 --- a/examples/authenticated_relayer/make_user_db.py +++ b/examples/authenticated_relayer/make_user_db.py @@ -5,7 +5,6 @@ import sqlite3 from hashlib import pbkdf2_hmac from pathlib import Path -from typing import Dict DB_FILE = "mail.db~"