Skip to content

Commit

Permalink
Fix code scanning issue (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Feb 5, 2024
1 parent 4576a9a commit 94710d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
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

0 comments on commit 94710d8

Please sign in to comment.