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 for #208 - TIdSMTP - correctly handle answer, if Initial-Response is not supported #530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jaenicke
Copy link

@jaenicke jaenicke commented Apr 11, 2024

Fix for #208 - If Initial-Response is not supported, the server might fail to handle the request completely or the server might ask for the username, because the server does not handle the provided username after AUTH LOGIN.

At the moment, the login is cancelled at this moment, so it does not work at all.

So I added functionality to answer the request for the username correctly and continue.
Note:
The encoded string 'Username:' is hardcoded directly in the code at the moment. A constant would be better, but I did not know where to put it correctly.

In addition I added a property CanAttemptIR to TIdSMTP, so one can switch off the try with IR in case the server cannot handle this at all. This was supported already, but the functionality was not exposed, because this parameter was always set to True.

…r the request for the username correctly and continue. In addition I added a property CanAttemptIR to TIdSMTP, so one can switch off the try with IR in case the server cannot handle this.
@rlebeau rlebeau added Type: Bug Issue is a bug in existing code Element: SASL Issues related to SASL handling, TIdSASL and descendants, etc Element: SMTP Issues related to TIdSMTP and TIdSMTPServer labels Apr 11, 2024
@rlebeau
Copy link
Member

rlebeau commented Apr 11, 2024

The change you propose for IdSASLCollection.pas really belongs in IdSASLLogin.pas instead, as such prompt handling is specific to the AUTH LOGIN command and not to other SASLs.

However, better handling of the AUTH LOGIN prompts was implemented in IdSASLLogin.pas 2 years ago in commit c9cf49, so this ticket really no longer applies to TIdSASLLogin and is still open as other SASLs still need to be reviewed for IR handling.

In the existing sasl-oauth branch, there is a new SASLCanAttemptInitialResponse property added to TIdPOP3. Such a property could be added to TIdSMTP, but I don't think it is necessary since SMTP doesn't have the same problem with detecting IR support that POP3 has. IdSASLCollection.pas already has logic in place to handle IR failure in POP3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Element: SASL Issues related to SASL handling, TIdSASL and descendants, etc Element: SMTP Issues related to TIdSMTP and TIdSMTPServer Type: Bug Issue is a bug in existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants