Comments (2)
Be sure to have a look at PR #66 to see the ongoing effort on implementing AUTH.
To solve the issue of reading additional information on a new line, use yield from self._reader.readline()
in your smtp_AUTH()
method. You might do something like:
class AuthSMTP(aiosmtpd.smtp.SMTP):
@asyncio.coroutine
def smtp_AUTH(self, arg):
if arg != 'PLAIN':
yield from self.push('501 Syntax: AUTH PLAIN')
return
yield from self.push('334')
try:
second_line = yield from self._reader.readline()
except (ConnectionResetError, asyncio.CancelledError) as error:
# How to recover here?
TODO
try:
second_line = second_line.rstrip(b'\r\n').decode('ascii')
except UnicodeDecodeError:
yield from self.push('500 Error: Challenge must be ASCII')
return
if second_line == 'dGVzdAB0ZXN0ADEyMzQ=':
self.authenticated = True
yield from self.push('235 Authentication successful')
else:
yield from self.push('535 Invalid credentials')
Of course, a bigger issue with implementing AUTH is changing the SMTP class to require authentication before issuing any other command, but that doesn't appear to be what you're asking about.
from aiosmtpd.
This has been fully implemented in PR #192 , waiting to be Code Reviewed & Merged.
from aiosmtpd.
Related Issues (20)
- Replace flake8 test with ruff HOT 3
- Controller.start() is missing type annotation
- Provide a way to start smtp server on random free port
- [Question] EHLO response in a single packet?
- Example authenticated replayer is not working; Solved
- Let's put `aiosmtpd` under the `aio-libs` org on PyPI HOT 5
- [good first issue] Fix the Read The Docs config file HOT 1
- Some tests in aiosmtpd/tests/test_server.py hang with python 3.12
- assert_smtp_socket fails with Python 3.13.0a3 HOT 1
- custom `handle_HELO` and `handle_EHLO`: 503 Error: send HELO first HOT 1
- 1.4.5: test suite and documentation source is part of the installed resources HOT 2
- Not found code using 'attrs' but it is required. HOT 3
- handle_DATA not called with Proxy Protocol HOT 1
- Old authenticators won't work
- Unable to connect to aiosmtpd server using TLS v1.1 ?
- 1.4.6: pytest fails because test suite uses deprecated `pkg_resources
- 1.4.6: sphinx warnings `reference target not found`
- 1.4.6: please move aiosmtpd/docs and aiosmtpd/tests to project root, and pep517 build warnings
- examples/authenticated_relayer/server.py uses a random salt value
- _trigger_server in infinite loop
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiosmtpd.