Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning issue #402

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions aiosmtpd/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion examples/authenticated_relayer/make_user_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sqlite3
from hashlib import pbkdf2_hmac
from pathlib import Path
from typing import Dict


DB_FILE = "mail.db~"
Expand Down
Loading