-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-64551: Add RFC 5034 AUTH support to poplib #142613
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
base: main
Are you sure you want to change the base?
Conversation
|
Can you please rebase/merge your branch on top of main please? |
done |
Thanks! I removed all the reviewers and added only the ones in the original issue. |
bitdancer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I have several suggestions, mostly about mimicing the smtplib API for consistency.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Hi, please avoid of force push in the future, see: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push |
i rebase, but i can not push, so i force push, sorry |
You can fetch the remote, then use |
| import re | ||
| import socket | ||
| import sys | ||
| import base64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the imports alphabetically sorted.
| (``bytes`` or ``str``). Return ``b'*'`` to abort the exchange. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (``bytes`` or ``str``). Return ``b'*'`` to abort the exchange. | |
| (``bytes`` or ``str``). Return ``b'*'`` to abort the exchange. | |
| .. versionadded:: next |
| If *initial_response* is provided (``bytes`` or ``str``), it is | ||
| base64-encoded and appended to the command after a single space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If *initial_response* is provided (``bytes`` or ``str``), it is | |
| base64-encoded and appended to the command after a single space. | |
| If *initial_response* is provided (as :class:`bytes` or :class:`str`), | |
| it is base64-encoded and appended to the command after a single space. |
| If *authobject* is provided, it is called with the server’s ``bytes`` | ||
| challenge (already base64-decoded) and must return the client response | ||
| (``bytes`` or ``str``). Return ``b'*'`` to abort the exchange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If *authobject* is provided, it is called with the server’s ``bytes`` | |
| challenge (already base64-decoded) and must return the client response | |
| (``bytes`` or ``str``). Return ``b'*'`` to abort the exchange. | |
| If *authobject* is provided, it is called with the server’s ``bytes`` | |
| challenge (already base64-decoded) and must return the client response | |
| as a :class:`bytes` or :class:`str`. If ``b'*'`` is returned, the exchange | |
| is aborted. |
| """ | ||
| return self._shortcmd('PASS %s' % pswd) | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid changing unrelated code.
|
|
||
| auth_challenge_count += 1 | ||
| if auth_challenge_count > _MAXCHALLENGE: | ||
| raise error_proto('Server AUTH mechanism infinite loop') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same message as in smtplib?
| resp = authobject(challenge) | ||
| if resp is None: | ||
| resp = b'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, authobject is allowed to return None. Should it be documented? or is it only kept for parity with legacy implementation of smtplib?
| def auth_plain(self, user, password, authzid=''): | ||
| """Return an authobject suitable for SASL PLAIN. | ||
| Result is 'str'. | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def auth_plain(self, user, password, authzid=''): | |
| """Return an authobject suitable for SASL PLAIN. | |
| Result is 'str'. | |
| """ | |
| def auth_plain(self, user, password, authzid=''): | |
| """Return an authobject suitable for SASL PLAIN.""" |
Why was there "result is 'str'"? and before "result is 'response'"? was it LLM-generated?
| # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL | ||
| # a real test suite | ||
|
|
||
| import base64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep a blank line before import base64.
| @@ -0,0 +1 @@ | |||
| Add RFC 5034 AUTH support to poplib | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Add RFC 5034 AUTH support to poplib | |
| :mod:`poplib`: add :rfc:`5034` ``AUTH`` support. |
Add RFC 5034 AUTH support to poplib
📚 Documentation preview 📚: https://cpython-previews--142613.org.readthedocs.build/