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

smtplib on linux fails to log in correctly #75483

Open
1kastner mannequin opened this issue Aug 29, 2017 · 2 comments
Open

smtplib on linux fails to log in correctly #75483

1kastner mannequin opened this issue Aug 29, 2017 · 2 comments
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@1kastner
Copy link
Mannequin

1kastner mannequin commented Aug 29, 2017

BPO 31302
Nosy @1kastner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2017-08-29.12:56:45.003>
labels = ['type-bug', 'library']
title = 'smtplib on linux fails to log in correctly'
updated_at = <Date 2017-08-29.13:18:18.791>
user = 'https://github.com/1kastner'

bugs.python.org fields:

activity = <Date 2017-08-29.13:18:18.791>
actor = 'murphdasurf'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2017-08-29.12:56:45.003>
creator = 'murphdasurf'
dependencies = []
files = []
hgrepos = []
issue_num = 31302
keywords = []
message_count = 2.0
messages = ['300986', '300987']
nosy_count = 1.0
nosy_names = ['murphdasurf']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue31302'
versions = ['Python 3.6']

@1kastner
Copy link
Mannequin Author

1kastner mannequin commented Aug 29, 2017

The protocol should run like this:

send: 'ehlo XXXXXXXXXXXXX\r\n'
reply: b'250-XXXXXXXXXXXXXXXXXX.com\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 100480000\r\n'
reply: b'250-VRFY\r\n'
reply: b'250-ETRN\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250 DSN\r\n'
reply: retcode (250); Msg: b'XXXXXXXXXXXXXXXX.com\nPIPELINING\nSIZE 100480000\nVRFY\nETRN\nSTARTTLS\nENHANCEDSTATUSCODES\n8BITMIME\nDSN'
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
send: 'ehlo XXXXXXXXXXXXXXXXXXXXX\r\n'
reply: b'250-XXXXXXXXXXXXXXXXXX.com\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 100480000\r\n'
reply: b'250-VRFY\r\n'
reply: b'250-ETRN\r\n'
reply: b'250-AUTH LOGIN\r\n'
reply: b'250-AUTH=LOGIN\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250 DSN\r\n'
reply: retcode (250); Msg: b'XXXXXXXXXXXXXXXXXXXXXX.com\nPIPELINING\nSIZE 100480000\nVRFY\nETRN\nAUTH LOGIN\nAUTH=LOGIN\nENHANCEDSTATUSCODES\n8BITMIME\nDSN'
send: 'AUTH LOGIN XXXXXXXXXXXXXXX\r\n'
reply: b'334 RRRRRRRRRRR\r\n'
reply: retcode (334); Msg: b'RRRRRRRRR'
send: 'TTTTTTTTTTTT=\r\n'
reply: b'235 2.7.0 Authentication successful\r\n'
reply: retcode (235); Msg: b'2.7.0 Authentication successful'

And in fact it does so on Windows. However, on Linux it runs like this:

send: 'ehlo XXXXXXXXXXXXX\r\n'
reply: b'250-XXXXXXXXXXXXX.com\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 100480000\r\n'
reply: b'250-VRFY\r\n'
reply: b'250-ETRN\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250 DSN\r\n'
reply: retcode (250); Msg: b'XXXXXXXXXXXXX.com\nPIPELINING\nSIZE 100480000\nVRFY\nETRN\nSTARTTLS\nENHANCEDSTATUSCODES\n8BITMIME\nDSN'
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
send: 'ehlo XXXXXXXXXXXXX\r\n'
reply: b'250-XXXXXXXXXXXXX.com\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-SIZE 100480000\r\n'
reply: b'250-VRFY\r\n'
reply: b'250-ETRN\r\n'
reply: b'250-AUTH LOGIN\r\n'
reply: b'250-AUTH=LOGIN\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250 DSN\r\n'
reply: retcode (250); Msg: b'XXXXXXXXXXXXX.com\nPIPELINING\nSIZE 100480000\nVRFY\nETRN\nAUTH LOGIN\nAUTH=LOGIN\nENHANCEDSTATUSCODES\n8BITMIME\nDSN'
send: 'AUTH LOGIN XXXXXXXXXXXXXXX\r\n'
reply: b'334 RRRRRRRRRRR\r\n'
reply: retcode (334); Msg: b'RRRRRRRRRRR'
send: "b''\r\n"
reply: b'535 5.7.8 Error: authentication failed: another step is needed in authentication\r\n'
reply: retcode (535); Msg: b'5.7.8 Error: authentication failed: another step is needed in authentication'

The last sent message is an empty string and then the authentication fails. All other tokens which are replaced by XXXXXX, RRRRR or TTTTT are exactly the same.

This way the login fails and I can not use smtplib to send my mail.

@1kastner 1kastner mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 29, 2017
@1kastner
Copy link
Mannequin Author

1kastner mannequin commented Aug 29, 2017

PS: The corresponding code is:

server_ssl = smtplib.SMTP(SERVER, PORT)
server_ssl.set_debuglevel(True)
server_ssl.ehlo()
server_ssl.starttls()
server_ssl.login(USER_FOR_AUTHENTICATION, XXXXXX)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant